fix(baggage): do not percent-encode W3C baggage metadata - #8682
Open
arimu1 wants to merge 1 commit into
Open
Conversation
Neither the W3C Baggage spec nor the OTel baggage API require percent encoding of metadata (W3C properties). Encoding breaks property key-value shape for other implementations on extract/inject round-trips. Only baggage entry values remain percent-encoded/decoded. Fixes open-telemetry#6771
|
|
Pull request dashboard statusWaiting on reviewers · refreshed 2026-08-01 05:43 UTC Review the latest changes. Status above doesn't look right?
|
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #8682 +/- ##
============================================
- Coverage 91.48% 91.48% -0.01%
Complexity 10467 10467
============================================
Files 1021 1021
Lines 27694 27691 -3
Branches 3247 3247
============================================
- Hits 25337 25333 -4
- Misses 1615 1616 +1
Partials 742 742 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
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
Fixes #6771.
The W3C Baggage propagator was percent-encoding and percent-decoding metadata (W3C properties) on inject/extract. That is not required by either the W3C Baggage spec or the OTel baggage API (metadata is an opaque string). Encoding breaks property key-value shape for other implementations after an extract→inject round-trip, e.g.:
Change: leave metadata untouched on inject and extract. Baggage entry values continue to be percent-encoded/decoded as before (aligned with the W3C requirement for list-member values).
This matches the approach used by opentelemetry-js (opaque pass-through).
Testing
W3CBaggagePropagatorTest.injectexpectation (metadata not encoded)inject_doesNotPercentEncodeMetadataextract_metadataNotPercentDecodedroundTrip_metadataPreservedOpaque,(safe without encoding)Local:
All green on Temurin 21.0.12 (macOS aarch64).
Compatibility note
This is a deliberate behavior change for interop with W3C-compliant / JS implementations. Callers that relied on Java-side percent-encoding of metadata will see raw metadata strings on the wire and on extract. Values are unchanged.
CNCF CLA: may need human sign-off if the CLA bot requests it.