fix: Complete array attribute serialization for all payload types#3531
Merged
tippmar-nr merged 5 commits intomainfrom Apr 10, 2026
Merged
fix: Complete array attribute serialization for all payload types#3531tippmar-nr merged 5 commits intomainfrom
tippmar-nr merged 5 commits intomainfrom
Conversation
PR #3456 added array serialization in JsonSerializerHelpers but missed two code paths: 1. GenericConverter in AttributeDefinition.cs - arrays fell through to ToString(), producing garbage strings like 'System.Int32[]' in transaction traces and events. 2. AttributeValue.SetValue in Segments/AttributeValue.cs - the protobuf-backed AttributeValue used by SpanAttributeValueCollection had no IEnumerable handling, so arrays fell through to TypeCode.Object -> ToString() in span events. Fixes both converters and adds unit tests (GenericConverter, SpanEventWireModel) and integration tests (transaction trace, transaction event, and span event assertions). Co-authored-by: GitHub Copilot <copilot@github.com>
nrcventura
reviewed
Apr 9, 2026
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #3531 +/- ##
==========================================
- Coverage 81.79% 81.78% -0.02%
==========================================
Files 508 508
Lines 34345 34365 +20
Branches 4061 4067 +6
==========================================
+ Hits 28092 28104 +12
- Misses 5285 5290 +5
- Partials 968 971 +3
Flags with carried forward coverage won't be shown. Click here to find out more.
🚀 New features to boost your workflow:
|
nrcventura
reviewed
Apr 10, 2026
nrcventura
approved these changes
Apr 10, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
PR #3456 added array serialization in
JsonSerializerHelpersbut missed two code paths:GenericConverter(AttributeDefinition.cs): NoIEnumerablecase — arrays fell through toToString(), producing garbage likeSystem.Int32[]in transaction traces and events.AttributeValue.SetValue(Segments/AttributeValue.cs): The protobuf-backedAttributeValuefor span events had noIEnumerablehandling — arrays fell through toTypeCode.Object→ToString()→ garbage strings.Changes
GenericConverter: AddedIEnumerablecase with recursive element conversion and null filteringSegments/AttributeValue: Added_arrayValuefield andIEnumerablehandling inSetValue; updatedValuegetter to return array dataGenericConverterTests(11 new),EventWireModelSerializerTests(5 new)Assertions.HaveSameValueforIEnumerableelement-wise comparison; addedSpanCustomAttributes_WithArraystestFixes #3530