Skip to content

Conversation

@lbeschastny
Copy link

@lbeschastny lbeschastny commented Oct 23, 2025

Propagators could leave spans in a deferred state. For example, the following valid set of b3-multi headers does eactly that:

X-B3-TraceId: 68f8e1942794b9a8072bfc5f4f2c368f
X-B3-SpanId: a4295738dcb1aac4

but ShouldSample implementation for opentelemetry_sdk::trace::sampler::Sampler only checks that the parent span is active.

The correct behaviour would be to fall back to delegate sampler when the parent spans has deferred flag set by a propagator.

Changes

Sampler::ParentBased branch in the should_sample method now checks is the parent span has TRACE_FLAG_DEFERRED set and filters all deferred spans.

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)

@lbeschastny lbeschastny requested a review from a team as a code owner October 23, 2025 10:09
@linux-foundation-easycla
Copy link

linux-foundation-easycla bot commented Oct 23, 2025

CLA Signed

The committers listed above are authorized under a signed CLA.

  • ✅ login: lbeschastny / name: Leonid Beschasny (cb7930d)

@codecov
Copy link

codecov bot commented Oct 23, 2025

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 80.9%. Comparing base (d721037) to head (cb7930d).

Additional details and impacted files
@@          Coverage Diff          @@
##            main   #3209   +/-   ##
=====================================
  Coverage   80.8%   80.9%           
=====================================
  Files        128     128           
  Lines      23090   23118   +28     
=====================================
+ Hits       18676   18704   +28     
  Misses      4414    4414           

☔ View full report in Codecov by Sentry.
📢 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.

@lbeschastny lbeschastny force-pushed the fix/psrent-based-sampler-with-deferred-trace branch from 97b5b50 to cb7930d Compare October 23, 2025 12:58
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.

1 participant