Skip to content

Conversation

@mabdinur
Copy link
Contributor

@mabdinur mabdinur commented Jan 20, 2026

Motivation

Add test coverage for the W3C trace-context-2 spec's randomness bit (bit 1) in trace flags to ensure:

  1. Setting the randomness bit doesn't break sampling decisions (only bit 0 determines sampling)
  2. New Datadog traces properly set the randomness bit to 1
  3. The randomness bit is propagated correctly when extracting headers

Changes

  • Added test_traceparent_trace_flags_sampling_with_randomness_bit: Verifies only bit 0 determines sampling, regardless of bit 1
  • Added test_traceparent_trace_flags_randomness_bit_new_trace: Tests new Datadog traces have randomness bit set to 1
  • Added test_traceparent_trace_flags_randomness_bit_propagation: Tests randomness bit propagation when extracting headers
  • Added skip entries to all language manifest files for the randomness bit tests (not supported yet)
  • Fixed parametric apps (PHP, Node.js, Ruby, Rust) to return SDK trace_flags as 2-digit hex instead of custom logic that only checked sampled bit

Workflow

  1. ⚠️ Create your PR as draft ⚠️
  2. Work on you PR until the CI passes
  3. Mark it as ready for review
    • Test logic is modified? -> Get a review from RFC owner.
    • Framework is modified, or non obvious usage of it -> get a review from R&P team

🚀 Once your PR is reviewed and the CI green, you can merge it!

🛟 #apm-shared-testing 🛟

Reviewer checklist

  • Anything but tests/ or manifests/ is modified ? I have the approval from R&P team
  • A docker base image is modified?
    • the relevant build-XXX-image label is present
  • A scenario is added, removed or renamed?

@mabdinur mabdinur changed the title Munir/add tests for randomness bit w3c tracecontext: Add traceparent randomness bit tests Jan 20, 2026
@github-actions
Copy link
Contributor

github-actions bot commented Jan 20, 2026

CODEOWNERS have been resolved as:

manifests/cpp.yml                                                       @DataDog/dd-trace-cpp
manifests/dotnet.yml                                                    @DataDog/apm-dotnet @DataDog/asm-dotnet
manifests/golang.yml                                                    @DataDog/dd-trace-go-guild
manifests/java.yml                                                      @DataDog/asm-java @DataDog/apm-java
manifests/nodejs.yml                                                    @DataDog/dd-trace-js
manifests/php.yml                                                       @DataDog/apm-php @DataDog/asm-php
manifests/python.yml                                                    @DataDog/apm-python @DataDog/asm-python
manifests/ruby.yml                                                      @DataDog/ruby-guild @DataDog/asm-ruby
manifests/rust.yml                                                      @DataDog/apm-rust
tests/parametric/test_headers_tracecontext.py                           @DataDog/system-tests-core @DataDog/apm-sdk-capabilities
utils/build/docker/nodejs/parametric/server.js                          @DataDog/dd-trace-js @DataDog/system-tests-core
utils/build/docker/php/parametric/server.php                            @DataDog/apm-php @DataDog/system-tests-core
utils/build/docker/ruby/parametric/server.rb                            @DataDog/ruby-guild @DataDog/asm-ruby @DataDog/system-tests-core
utils/build/docker/rust/parametric/src/opentelemetry/mod.rs             @DataDog/apm-rust @DataDog/system-tests-core

@datadog-official

This comment has been minimized.

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