Skip to content

Commit b984e63

Browse files
authored
Fix span event serialization for array attributes (#5490)
1 parent f62b60a commit b984e63

2 files changed

Lines changed: 10 additions & 8 deletions

File tree

packages/dd-trace/src/encode/0.4.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -395,7 +395,7 @@ function convertSpanEventAttributeValues (key, value, depth = 0) {
395395
if (convertedArray.length > 0) {
396396
return {
397397
type: 4,
398-
array_value: convertedArray
398+
array_value: { values: convertedArray }
399399
}
400400
} else {
401401
// If all elements were unsupported, return undefined

packages/dd-trace/test/encode/0.4.spec.js

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -522,12 +522,14 @@ describe('encode', () => {
522522
rating: { type: 3, double_value: 9.8 },
523523
other: {
524524
type: 4,
525-
array_value: [
526-
{ type: 0, string_value: 'hi' },
527-
{ type: 1, bool_value: false },
528-
{ type: 2, int_value: 1 },
529-
{ type: 3, double_value: 1.2 }
530-
]
525+
array_value: {
526+
values: [
527+
{ type: 0, string_value: 'hi' },
528+
{ type: 1, bool_value: false },
529+
{ type: 2, int_value: 1 },
530+
{ type: 3, double_value: 1.2 }
531+
]
532+
}
531533
}
532534
}
533535
}
@@ -568,7 +570,7 @@ describe('encode', () => {
568570
{
569571
name: 'I can sing!!!',
570572
time_unix_nano: 1633023102000000,
571-
attributes: { array: { type: 4, array_value: [{ type: 0, string_value: 'valid_value' }] } }
573+
attributes: { array: { type: 4, array_value: { values: [{ type: 0, string_value: 'valid_value' }] } } }
572574
}
573575
]
574576

0 commit comments

Comments
 (0)