Skip to content

Comments

Propagate Trace Context Level 2 random flag#1731

Merged
brettmc merged 2 commits intoopen-telemetry:mainfrom
Nevay:feature/support-tracecontext-level2-random-flag
Oct 19, 2025
Merged

Propagate Trace Context Level 2 random flag#1731
brettmc merged 2 commits intoopen-telemetry:mainfrom
Nevay:feature/support-tracecontext-level2-random-flag

Conversation

@Nevay
Copy link
Contributor

@Nevay Nevay commented Oct 15, 2025

Updates TraceContextPropagator and SpanBuilder to propagate the Trace Context Level 2 random flag.

https://opentelemetry.io/docs/specs/otel/context/api-propagators/#w3c-trace-context-requirements:

A W3C Trace Context propagator MUST parse and validate the traceparent and tracestate HTTP headers as specified in W3C Trace Context Level 2. A W3C Trace Context propagator MUST propagate a valid traceparent value using the same header.

https://www.w3.org/TR/trace-context-2/#random-trace-id-flag

When continuing a trace (that is, the incoming HTTP request had the traceparent header and the participant uses the same trace-id in the traceparent header on outgoing requests), the following rules apply:

  • If the flag is set in the incoming traceparent header, it MUST also be set in all outgoing traceparent headers which use the same trace-id.
  • If the flag is unset in the incoming traceparent header, it MUST also be unset in any outgoing traceparent headers which use the same trace-id.

@Nevay Nevay requested a review from a team as a code owner October 15, 2025 20:22
@Nevay Nevay force-pushed the feature/support-tracecontext-level2-random-flag branch from b3956fd to dae0be9 Compare October 15, 2025 20:23
@codecov
Copy link

codecov bot commented Oct 15, 2025

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 68.42%. Comparing base (ddb222d) to head (dae0be9).
⚠️ Report is 4 commits behind head on main.

Additional details and impacted files

Impacted file tree graph

@@             Coverage Diff              @@
##               main    #1731      +/-   ##
============================================
+ Coverage     68.37%   68.42%   +0.05%     
+ Complexity     2971     2968       -3     
============================================
  Files           448      448              
  Lines          9020     9023       +3     
============================================
+ Hits           6167     6174       +7     
+ Misses         2853     2849       -4     
Flag Coverage Δ
8.1 68.10% <100.00%> (+0.04%) ⬆️
8.2 68.26% <100.00%> (+0.02%) ⬆️
8.3 68.30% <100.00%> (+0.08%) ⬆️
8.4 68.30% <100.00%> (+0.05%) ⬆️
8.5 68.30% <100.00%> (+0.10%) ⬆️

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

Files with missing lines Coverage Δ
...c/API/Trace/Propagation/TraceContextPropagator.php 98.18% <100.00%> (ø)
src/SDK/Trace/SpanBuilder.php 91.01% <100.00%> (+6.12%) ⬆️

... and 4 files with indirect coverage changes


Continue to review full report in Codecov by Sentry.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update ddb222d...dae0be9. Read the comment docs.

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

@brettmc brettmc merged commit 293e65c into open-telemetry:main Oct 19, 2025
11 checks passed
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.

2 participants