Skip to content

feat(trace): support the W3C random trace ID flag - #3718

Open
ayush-that wants to merge 27 commits into
open-telemetry:mainfrom
ayush-that:shydev/w3c-random-flag
Open

ayush-that wants to merge 27 commits into
open-telemetry:mainfrom
ayush-that:shydev/w3c-random-flag

Conversation

@ayush-that

@ayush-that ayush-that commented Sep 9, 2026 •

Copy link
Copy Markdown

Fixes #3270

Changes

Random trace IDs can now wear their little badge.

Adds RANDOM helpers, generator opt-in, SDK flag handling, and W3C propagation. Custom generators must implement is_random() explicitly; RandomIdGenerator returns true. Children retain the flag even when dropped.

B3's private deferred bit moves out of the way. Local drops clear it, and OTLP conversions filter private bits while preserving W3C flags.

Tests, Clippy, formatting, docs, and all precommit stages passed.

Merge requirement checklist

  • CONTRIBUTING guidelines followed
  • Unit tests added/updated (if applicable)
  • Appropriate CHANGELOG.md files updated for non-trivial, user-facing changes
  • Changes in public API reviewed (if applicable)

@ayush-that
ayush-that requested a review from a team as a code owner September 9, 2026 09:14
@codecov

codecov Bot commented Sep 9, 2026 •

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 99.77827% with 1 line in your changes missing coverage. Please review.
✅ Project coverage is 84.6%. Comparing base (02b2f15) to head (b3247c3).

Files with missing lines Patch % Lines
opentelemetry-appender-tracing/src/layer.rs 50.0% 1 Missing ⚠️
Additional details and impacted files
@@           Coverage Diff           @@
##            main   #3718     +/-   ##
=======================================
+ Coverage   84.2%   84.6%   +0.3%     
=======================================
  Files        123     123             
  Lines      30484   30894    +410     
=======================================
+ Hits       25686   26144    +458     
+ Misses      4798    4750     -48     

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

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

Comment thread opentelemetry-sdk/src/trace/tracer.rs Outdated
Comment thread opentelemetry-zipkin/src/propagator/mod.rs
Comment thread opentelemetry-sdk/src/trace/tracer.rs
@ayush-that
ayush-that requested a review from lalitb September 10, 2026 21:55
@opentelemetry-pr-dashboard

opentelemetry-pr-dashboard Bot commented Sep 14, 2026 •

Copy link
Copy Markdown

Pull request dashboard status

Waiting on maintainers · refreshed 2026-10-17 01:45 UTC

Merge when ready.

Status above doesn't look right?
  • Just replied or pushed? Anything around or after the refresh time above may not be picked up yet — give it a few minutes.
  • Anything look wrong? Report it with what you expected; it helps us improve the dashboard.

@lalitb lalitb left a comment

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.

LGTM. Although the SDK randomness extension is still marked Development in the spec, Python and Java already expose it in their stable SDKs, so I’m comfortable following the same approach here, unless other @open-telemetry/rust-maintainers / @open-telemetry/rust-approvers have any concerns.

@ayush-that
ayush-that force-pushed the shydev/w3c-random-flag branch from 34b6b02 to 25ee034 Compare September 18, 2026 11:25
@ayush-that
ayush-that force-pushed the shydev/w3c-random-flag branch from 25ee034 to 26d9998 Compare September 18, 2026 17:58
Comment thread opentelemetry-sdk/src/trace/id_generator/mod.rs Outdated
Comment thread opentelemetry-sdk/CHANGELOG.md
Comment thread opentelemetry-sdk/src/trace/tracer.rs
@darkraider01 darkraider01 mentioned this pull request Sep 28, 2026
41 tasks
@scottgerring

Copy link
Copy Markdown
Member

hey @ayush-that , thanks for addressing comments! Can you resolve the conflict with main so we can merge this?

Comment thread opentelemetry-proto/src/transform/common.rs
@opentelemetry-pr-dashboard

This comment has been minimized.

This branch has not been deployed

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

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Feature]: Support the new W3C random flag.

5 participants