Skip to content

oss_17_jaeger_debug_and_parentbased_trace_state - #33

Open
ocelotl wants to merge 1 commit into
mainfrom
oss_17_jaeger_debug_and_parentbased_trace_state
Open

oss_17_jaeger_debug_and_parentbased_trace_state#33
ocelotl wants to merge 1 commit 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

@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.

@github-actions

github-actions Bot commented Aug 6, 2026

Copy link
Copy Markdown

This PR has been automatically marked as stale because it has not had any activity for 14 days. It will be closed if no further activity occurs within 14 days of this comment.
If you're still working on this, please add a comment or push new commits.

@github-actions github-actions Bot added the Stale label Aug 6, 2026
@ocelotl
ocelotl force-pushed the oss_17_jaeger_debug_and_parentbased_trace_state branch from c80022c to 87eb57e Compare August 7, 2026 20:55
The Jaeger propagator forced the DEBUG (forced-keep) flag on inject for
every sampled span, overriding downstream sampling decisions. Propagate
only the SAMPLED bit instead.
@ocelotl
ocelotl force-pushed the oss_17_jaeger_debug_and_parentbased_trace_state branch from 87eb57e to 98993c9 Compare August 7, 2026 22:25
@ocelotl

ocelotl commented Aug 7, 2026

Copy link
Copy Markdown
Owner Author

🔒 Internal (dash0) — reworked after upstream advanced. Rebased onto current upstream/main and trimmed to what's still a real gap: kept the Jaeger propagator fix (inject only the SAMPLED bit, not forced DEBUG — the propagator still exists; open-telemetry#5494 only replaced the jaeger exporter). Dropped both the Tracer trace_state edit and the ParentBased-delegate forwarding: upstream's sampling rework (_get_parent_trace_state(parent_context)) now delivers the parent trace_state to every delegate, so T4 is handled upstream. This PR is now jaeger-only. Tests: propagator 18 + sampling 13 pass.

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

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

oss_17_jaeger_debug_and_parentbased_trace_state

1 participant