Skip to content

[RUM-11495]: Supporting baggage header updates#2881

Merged
satween merged 2 commits into
developfrom
tvaleev/feature/RUM-11495-baggage
Sep 24, 2025
Merged

[RUM-11495]: Supporting baggage header updates#2881
satween merged 2 commits into
developfrom
tvaleev/feature/RUM-11495-baggage

Conversation

@satween

@satween satween commented Sep 15, 2025

Copy link
Copy Markdown
Contributor

What does this PR do?

Adds a logic to properly support W3C's baggage header.. Existing logic just re-write the baggage header value every time new item was added. This PR changes this logic and allows to update header value. SDK will replace item only if item keys are equal.

Note that Baggage implementation is taken from dd-trace-java and modified a bit.

Review checklist (to be filled by reviewers)

  • Feature or bugfix MUST have appropriate tests (unit, integration, e2e)
  • Make sure you discussed the feature or bugfix with the maintaining team in an Issue
  • Make sure each commit and the PR mention the Issue number (cf the CONTRIBUTING doc)

@satween
satween requested review from a team as code owners September 15, 2025 17:04
Comment on lines +371 to +372
Baggage baggage = new Baggage();
final String sessionId = (String) context.getTags().get(RUM_SESSION_ID_KEY);

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

shouldn't we take everything from the context? because if it is extracted context and there were other tags there, we won't propagate them

@satween satween Sep 19, 2025

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not clear what "everything" we should take from the context. This code just refactor of the existing logic in DatadogHttpCodec and W3CHttpCodec.

Are you suggesting to get sessionId directly from context, but not from the tags ?

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nevermind. I was thinking that this baggage should go into ExtractedContext if we are working with the request already having propagation context, but it seems Codecs logic of working with baggageItems is about ot-baggage (so I was thinking that proper merge should be done in the inject as well, preserving items from DDSpanContext), but it seems now the work of supporting this is shifted to mergeBaggage in TracingInterceptor.

@satween
satween force-pushed the tvaleev/feature/RUM-11495-baggage branch from 9b48732 to b6b8ce7 Compare September 16, 2025 12:56
@codecov-commenter

codecov-commenter commented Sep 16, 2025

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 64.83051% with 83 lines in your changes missing coverage. Please review.
✅ Project coverage is 70.96%. Comparing base (d20aaa2) to head (c33655b).
⚠️ Report is 1378 commits behind head on develop.

Files with missing lines Patch % Lines
...in/java/com/datadog/trace/util/PercentEscaper.java 60.65% 51 Missing and 10 partials ⚠️
...datadog/android/okhttp/trace/TracingInterceptor.kt 54.55% 10 Missing ⚠️
...va/com/datadog/trace/core/propagation/Baggage.java 86.67% 5 Missing and 1 partial ⚠️
...og/android/trace/internal/DatadogTracingToolkit.kt 0.00% 3 Missing ⚠️
...tadog/trace/core/propagation/DatadogHttpCodec.java 66.67% 0 Missing and 1 partial ⚠️
.../com/datadog/trace/core/propagation/HttpCodec.java 80.00% 0 Missing and 1 partial ⚠️
...m/datadog/trace/core/propagation/W3CHttpCodec.java 66.67% 0 Missing and 1 partial ⚠️
Additional details and impacted files
@@             Coverage Diff             @@
##           develop    #2881      +/-   ##
===========================================
- Coverage    71.11%   70.96%   -0.15%     
===========================================
  Files          810      812       +2     
  Lines        29677    29898     +221     
  Branches      4967     5007      +40     
===========================================
+ Hits         21104    21216     +112     
- Misses        7230     7295      +65     
- Partials      1343     1387      +44     
Files with missing lines Coverage Δ
...tadog/trace/core/propagation/DatadogHttpCodec.java 13.68% <66.67%> (+7.37%) ⬆️
.../com/datadog/trace/core/propagation/HttpCodec.java 30.00% <80.00%> (+2.38%) ⬆️
...m/datadog/trace/core/propagation/W3CHttpCodec.java 12.99% <66.67%> (+9.09%) ⬆️
...og/android/trace/internal/DatadogTracingToolkit.kt 21.43% <0.00%> (-5.84%) ⬇️
...va/com/datadog/trace/core/propagation/Baggage.java 86.67% <86.67%> (ø)
...datadog/android/okhttp/trace/TracingInterceptor.kt 83.14% <54.55%> (-0.85%) ⬇️
...in/java/com/datadog/trace/util/PercentEscaper.java 60.65% <60.65%> (ø)

... and 38 files with indirect coverage changes

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@satween
satween force-pushed the tvaleev/feature/RUM-11495-baggage branch from b6b8ce7 to c33655b Compare September 19, 2025 13:15
@satween
satween merged commit 6de04ce into develop Sep 24, 2025
25 checks passed
@satween
satween deleted the tvaleev/feature/RUM-11495-baggage branch September 24, 2025 09:38
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants