Skip to content

Conversation

@marcalff
Copy link
Member

@marcalff marcalff commented Nov 14, 2025

Fixes #3725

Changes

Please provide a brief description of the changes here.

  • When a sampler returns Decision::DROP or Decision::RECORD_ONLY, clear the trace sample flag, per specs.

For significant contributions please make sure you have completed the following items:

  • CHANGELOG.md updated for non-trivial changes
  • Unit tests have been added
  • Changes in public API reviewed

@marcalff marcalff requested a review from a team as a code owner November 14, 2025 22:21
@codecov
Copy link

codecov bot commented Nov 14, 2025

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 89.91%. Comparing base (907277c) to head (c62bc3e).
⚠️ Report is 1 commits behind head on main.

Additional details and impacted files

Impacted file tree graph

@@            Coverage Diff             @@
##             main    #3745      +/-   ##
==========================================
+ Coverage   89.91%   89.91%   +0.01%     
==========================================
  Files         225      225              
  Lines        7134     7135       +1     
==========================================
+ Hits         6414     6415       +1     
  Misses        720      720              
Files with missing lines Coverage Δ
api/include/opentelemetry/trace/trace_flags.h 100.00% <ø> (ø)
sdk/src/trace/tracer.cc 83.88% <100.00%> (+0.27%) ⬆️
🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.


TEST(Tracer, SpanSamplerDecision)
{
InMemorySpanExporter *exporter = new InMemorySpanExporter();
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit - prefer make_unique/make_shared in place of new.

Copy link
Member

@dbarker dbarker left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good. Thanks! Minor nitpick on new -> make_unique/make_shared.

@ThomsonTan ThomsonTan merged commit d6301b7 into open-telemetry:main Nov 17, 2025
67 checks passed
malkia added a commit to malkia/opentelemetry-cpp that referenced this pull request Nov 17, 2025
[SDK] Reset TraceFlags::IsSampled bit on sampler Decision::DROP (open-telemetry#3745)
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.

Child spans inherit the parent’s TraceFlags::kIsSampled bit even when the active sampler returns Decision::DROP

3 participants