[Api] Fix empty tracestate extraction#7407
Merged
Merged
Conversation
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #7407 +/- ##
==========================================
- Coverage 89.72% 89.71% -0.01%
==========================================
Files 276 276
Lines 14576 14576
==========================================
- Hits 13078 13077 -1
- Misses 1498 1499 +1
Flags with carried forward coverage won't be shown. Click here to find out more.
|
martincostello
approved these changes
Jun 12, 2026
rajkumar-rangaraj
approved these changes
Jun 12, 2026
This was referenced Jul 16, 2026
Closed
Merged
Open
This was referenced Jul 17, 2026
Open
Open
Merged
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.
Broader fix of open-telemetry/opentelemetry-dotnet-contrib#4503
Changes
Normalize valid empty
tracestateheader values tonullwhen extracting W3C trace context withTraceContextPropagator.The W3C Trace Context specification requires vendors to accept empty
tracestateheaders, while recommending that senders avoid producing them:https://www.w3.org/TR/trace-context/#tracestate-header-field-values
Before this change, a present-but-empty
tracestateheader extracted asActivityContext.TraceState == "", while an absenttracestateheader extracted asnull. Both represent no trace state, but the observable difference can cause downstream code comparing OpenTelemetry-extracted context with runtime-createdActivitycontext to treat them as different parents.This change keeps malformed non-empty
tracestatebehavior unchanged, but normalizes valid empty or whitespace-onlytracestatevalues tonull.Tests
Added coverage for present empty/whitespace
tracestatevalues:tracestate: ""tracestate: " "tracestate: " , "Merge requirement checklist
CHANGELOG.mdfiles updated for non-trivial changes[ ] Changes in public API reviewed (if applicable)