Skip to content

Align Baggage API name and value handling to match the v1.36.0 specification - #6931

Merged
rajkumar-rangaraj merged 8 commits into
open-telemetry:mainfrom
zacharycmontoya:update-baggage-api-to-spec
Mar 10, 2026
Merged

rajkumar-rangaraj merged 8 commits into
open-telemetry:mainfrom
zacharycmontoya:update-baggage-api-to-spec

Conversation

@zacharycmontoya

@zacharycmontoya zacharycmontoya commented Mar 4, 2026 •

Copy link
Copy Markdown
Member

Partially addresses #5210
Design discussion issue: N/A

Changes

This PR updates the OpenTelemetry.Baggage type so that it handles baggage name and values in accordance with the v1.36.0 specification:

  • Baggage names and values are treated as case sensitive
  • Baggage names are any valid, non-empty UTF-8 strings
  • Baggage values are any valid UTF-8 strings

No changes were required to handle UTF-8 strings, but new tests were added to assert this behavior.

⚠️ Although the API contract has not changed, this is a BREAKING change as users of this API who previously inserted baggage items whose names only differ in case-sensitivity will now see individual baggage items, whereas they would previously collide.

Merge requirement checklist

  • CONTRIBUTING guidelines followed (license requirements, nullable enabled, static analysis, etc.)
  • Unit tests added/updated
  • Appropriate CHANGELOG.md files updated for non-trivial changes
  • Changes in public API reviewed (if applicable)

@zacharycmontoya
zacharycmontoya requested a review from a team as a code owner March 4, 2026 00:46
@github-actions github-actions Bot added the pkg:OpenTelemetry.Api Issues related to OpenTelemetry.Api NuGet package label Mar 4, 2026
@codecov

codecov Bot commented Mar 4, 2026 •

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 88.51%. Comparing base (bb25768) to head (fbc4fd0).
⚠️ Report is 2 commits behind head on main.
✅ All tests successful. No failed tests found.

Additional details and impacted files

Impacted file tree graph

@@            Coverage Diff             @@
##             main    #6931      +/-   ##
==========================================
+ Coverage   88.49%   88.51%   +0.01%     
==========================================
  Files         263      263              
  Lines       12408    12411       +3     
==========================================
+ Hits        10980    10985       +5     
+ Misses       1428     1426       -2     
Flag Coverage Δ
unittests-Project-Experimental 88.23% <100.00%> (-0.25%) ⬇️
unittests-Project-Stable 88.35% <100.00%> (+0.05%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

Files with missing lines Coverage Δ
src/OpenTelemetry.Api/Baggage.cs 100.00% <100.00%> (ø)

... and 3 files with indirect coverage changes

Comment thread src/OpenTelemetry.Api/CHANGELOG.md Resolved
@Kielek

Kielek commented Mar 4, 2026

Copy link
Copy Markdown
Member

Please check also https://github.com/open-telemetry/opentelemetry-dotnet/actions/runs/22649769411/job/65646261419?pr=6931

test/OpenTelemetry.Api.Tests/BaggageTests.cs [FAIL]
  Non-ASCII character found at Ln:34 b'            new("a \xe2\x9c\x85", "B% \xf0\x9f\x92\xbc"),\n'
  Non-ASCII character found at Ln:41 b'        baggage = baggage.SetBaggage("a \xe2\x9c\x85", "B% \xf0\x9f\x92\xbc");\n'
  Non-ASCII character found at Ln:55 b'        Assert.Equal("B% \xf0\x9f\x92\xbc", Baggage.Current.GetBaggage("a \xe2\x9c\x85"));\n'

…n testing that baggage names and values can accept any valid UTF-8 string. This tests both Unicode characters in Basic Multilingual Plane (U+0000 to U+FFFF) and in supplementary code points (U+10000 to U+10FFFF)
@zacharycmontoya zacharycmontoya changed the title Update Baggage API to treat baggage names as case sensitive Align Baggage API name and value handling to match the v1.36.0 specification Mar 5, 2026
@Kielek

Kielek commented Mar 5, 2026

Copy link
Copy Markdown
Member

I checked also v1.54.0 version - only redactional changes related to the scope of PR. open-telemetry/opentelemetry-specification@v1.36.0...v1.54.0#diff-3d2a0e870c26fa9f2827cc33bd44f1b56939c65a35f55d5d988ebfd6a8d08c82
there is more stuff related to env. var. but it is out of the scope.

@rajkumar-rangaraj
rajkumar-rangaraj added this pull request to the merge queue Mar 10, 2026
Merged via the queue into open-telemetry:main with commit 8824380 Mar 10, 2026
63 checks passed
@github-actions

Copy link
Copy Markdown
Contributor

Thank you for your contribution @zacharycmontoya! 🎉 We would like to hear from you about your experience contributing to OpenTelemetry by taking a few minutes to fill out this survey.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

pkg:OpenTelemetry.Api Issues related to OpenTelemetry.Api NuGet package

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants