Skip to content

oss_17_jaeger_debug_and_parentbased_trace_state#33

Open
ocelotl wants to merge 2 commits into
mainfrom
oss_17_jaeger_debug_and_parentbased_trace_state
Open

oss_17_jaeger_debug_and_parentbased_trace_state#33
ocelotl wants to merge 2 commits into
mainfrom
oss_17_jaeger_debug_and_parentbased_trace_state

Conversation

@ocelotl

@ocelotl ocelotl commented Jul 22, 2026

Copy link
Copy Markdown
Owner

Closes #28

Jaeger inject now propagates only the SAMPLED bit (no forced DEBUG); ParentBased forwards trace_state to its delegate and the SDK passes the parent trace_state into should_sample (Linear OSS-17, findings P4/T4).

Validation: scope contained to propagator-jaeger + opentelemetry-sdk + changelog; jaeger suite 18 passed, sdk sampling+trace 124 passed. Note: one pre-existing test that asserted the old forced-DEBUG behavior was replaced.

Linear issue: https://linear.app/dash0/issue/OSS-17/p4-t4-jaeger-forces-debug-bit-on-all-sampled-spans-parentbased-drops

Jaeger propagator inject no longer ORs in the DEBUG (forced-keep) flag for
a normally-sampled span; it now propagates only the SAMPLED flag, avoiding
forcing downstream Jaeger components into a forced-keep decision.

ParentBased.should_sample now forwards the incoming trace_state to its
delegate sampler, and the SDK Tracer now passes the parent span context's
trace_state into should_sample, so the documented trace_state parameter is
actually delivered to custom delegate samplers.
@ocelotl

ocelotl commented Jul 22, 2026

Copy link
Copy Markdown
Owner Author

🔒 Internal (dash0) — not for upstream.

@ocelotl

ocelotl commented Jul 22, 2026

Copy link
Copy Markdown
Owner Author

📣 Public-facing draft — to be used for the upstream PR in open-telemetry/opentelemetry-python. No internal references; copy verbatim.

Title: Fix Jaeger inject debug flag and ParentBased trace_state forwarding

What

  • Jaeger propagator: on inject, propagate only the SAMPLED trace flag instead of OR-ing in the Jaeger DEBUG flag (0x02) for every sampled span.
  • ParentBased.should_sample: forward the incoming trace_state to the selected delegate sampler.
  • SDK Tracer.start_span: pass the parent span context's trace_state into self.sampler.should_sample(...).

Why

  • The Jaeger DEBUG flag is a forced-keep signal; setting it on every normally-sampled span overrides downstream sampling, and inject was asymmetric with extract (which masks to SAMPLED only). After this change a normally-sampled span injects flags 0x01 with the DEBUG bit clear.
  • Sampler.should_sample documents a trace_state parameter, but ParentBased dropped it and the SDK never supplied it, so custom delegates always saw None. Both now deliver trace_state, per the trace/sdk.md sampler contract.

Spec

specification/trace/sdk.md lists trace_state among ShouldSample inputs; a composite sampler must pass inputs to its delegate.

Tests

  • propagator-jaeger: replaced the test asserting DEBUG-on-inject with one asserting SAMPLED set / DEBUG clear for a sampled span. Suite: 18 passed.
  • opentelemetry-sdk: added a test that a delegate under ParentBased receives the forwarded trace_state. test_sampling.py + test_trace.py: 124 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.

oss_17_jaeger_debug_and_parentbased_trace_state

1 participant