Skip to content

Fix incubator sampler spec compliance gaps - #9050

Open
arimu1 wants to merge 1 commit into
open-telemetry:mainfrom
arimu1:fix/9047-incubator-sampler-spec
Open

arimu1 wants to merge 1 commit into
open-telemetry:mainfrom
arimu1:fix/9047-incubator-sampler-spec

Conversation

@arimu1

@arimu1 arimu1 commented Nov 22, 2026 •

Copy link
Copy Markdown
Contributor

Summary

  • ComposableParentThresholdSampler treats a parent threshold as consistent only when the sampled flag matches R >= T. An unsampled parent with th <= R now returns an invalid threshold, so CompositeSampler drops the child instead of sampling it. A consistent unsampled parent (rv < th, including the existing rv=1, th=10 case) still keeps that threshold.
  • CompositeSampler.getAttributes() returns empty attributes on DROP. Intent attributes are added only on a positive decision, so an annotating sampler no longer leaks them onto a dropped span.
  • getUpdatedTraceState applies the intent updater to its parentTraceState argument, then still overwrites the ot key with the threshold computed in shouldSample.

Fixes #9047.

Test plan

JDK 25 (Temurin 25.0.4+7):

./gradlew :sdk-extensions:incubator:test --tests io.opentelemetry.sdk.extension.incubator.trace.samplers.ComposableParentThresholdSamplerTest --tests io.opentelemetry.sdk.extension.incubator.trace.samplers.CompositeSamplerTest

ComposableParentThresholdSamplerTest 9/9 and CompositeSamplerTest 20/20 passed.

Treat an unsampled parent threshold as consistent only when it matches R >= T, omit sampling-intent attributes on DROP, and apply tracestate updates to the parentTraceState argument.
@arimu1
arimu1 requested a review from a team as a code owner November 22, 2026 09:50
@opentelemetry-pr-dashboard

opentelemetry-pr-dashboard Bot commented Nov 22, 2026 •

Copy link
Copy Markdown

Pull request dashboard status

Waiting on reviewers · refreshed 2026-11-22 10:18 UTC

Review the latest changes.

Status above doesn't look right?
  • Just replied or pushed? Anything around or after the refresh time above may not be picked up yet — give it a few minutes.
  • Anything look wrong? Report it with what you expected; it helps us improve the dashboard.

@codecov

codecov Bot commented Nov 22, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 90.44%. Comparing base (f0549eb) to head (afaca70).

Additional details and impacted files
@@             Coverage Diff              @@
##               main    #9050      +/-   ##
============================================
- Coverage     90.45%   90.44%   -0.01%     
  Complexity    11182    11182              
============================================
  Files          1032     1032              
  Lines         30508    30510       +2     
  Branches       3992     3992              
============================================
- Hits          27596    27595       -1     
- Misses         1935     1938       +3     
  Partials        977      977              

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

This branch has not been deployed

No deployments
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.

[incubator] CompositeSampler and ComposableParentThresholdSampler spec compliance gaps

1 participant