[release/3.1] Preserve client order of activity baggage items (#26302) #26398
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.
Backport #26302 from master to release/3.1
Description
ASP.NET Core populates
Activity.Baggage
items based on the incomingCorrelation-Context
HTTP header.This PR changes the order in which items are added to
Activity.Baggage
.Customer Impact
Since the W3C spec for baggage allows for duplicate keys order is important.
Activity.GetBaggageItem()
doesn't have predictable behavior today in the presence of duplicate key since the order of items inActivity.Baggage
gets flipped at every HTTP hop.Regression
This has always been broken since we never tested
Activity.GetBaggageItem()
with duplicate keys.Testing
We have a unit test verifying this is the desired behavior.
Risk
The result of
Activity.GetBaggageItem()
will change in certain scenarios. Someone relying on the existing behavior could be impacted, however this is extremely unlikely.We don't yet expect folks to directly be consuming this API. It's better to fix this API before OpenTelemetry (in beta, tracking towards GA) adoption increases usage of this API.