Skip to content

Restore compliance between Composite Samplers code and specs#8450

Open
PeterF778 wants to merge 2 commits into
open-telemetry:mainfrom
PeterF778:Restore_compliance_between_Composite_Samplers_code_and_specs
Open

Restore compliance between Composite Samplers code and specs#8450
PeterF778 wants to merge 2 commits into
open-telemetry:mainfrom
PeterF778:Restore_compliance_between_Composite_Samplers_code_and_specs

Conversation

@PeterF778

Copy link
Copy Markdown
Contributor

The Composite Samplers based on Consistent Probability Sampling are described at https://github.com/open-telemetry/opentelemetry-specification/blob/v1.57.0/oteps/trace/0250-Composite_Samplers.md

@PeterF778 PeterF778 requested a review from a team as a code owner June 3, 2026 20:58
@codecov

codecov Bot commented Jun 3, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 78.51%. Comparing base (79608eb) to head (f8588d2).
⚠️ Report is 26 commits behind head on main.

❌ Your project check has failed because the head coverage (78.22%) is below the target coverage (89.00%). You can increase the head coverage or adjust the target coverage.

Additional details and impacted files
@@              Coverage Diff              @@
##               main    #8450       +/-   ##
=============================================
- Coverage     91.02%   78.51%   -12.51%     
- Complexity     7817     8601      +784     
=============================================
  Files           893     1013      +120     
  Lines         23719    29148     +5429     
  Branches       2364     3631     +1267     
=============================================
+ Hits          21590    22887     +1297     
- Misses         1408     5420     +4012     
- Partials        721      841      +120     

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

@zeitlinger zeitlinger left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

I agree with removing traceId from GetSamplingIntent and with the adjusted-count naming, but the OTEP still lists TraceId as a required Predicate argument. Is that part of the OTEP stale/inconsistent? If so, could you link the spec issue/PR or clarify the intended interpretation here?

@PeterF778

Copy link
Copy Markdown
Contributor Author

the OTEP still lists TraceId as a required Predicate argument. Is that part of the OTEP stale/inconsistent? If so, could you link the spec issue/PR or clarify the intended interpretation here?

Good catch! Yes, the OTEP (https://github.com/open-telemetry/opentelemetry-specification/blob/v1.57.0/oteps/trace/0250-Composite_Samplers.md#predicate) lists TraceId as a parameter, but this is a mistake. Predicates and GetSamplingIntent must not depend on trace id for the same reasons.
The prototype implementation (https://github.com/open-telemetry/opentelemetry-java-contrib/blob/main/consistent-sampling/src/main/java/io/opentelemetry/contrib/sampler/consistent56/Predicate.java) does not have this parameter.

@jack-berg

Copy link
Copy Markdown
Member

@PeterF778 this looks good but for the sampling SIG - OTEPs are just the original proposal but stop being the source of truth once they are codified in spec text. In this case, the source of truth is now: https://github.com/open-telemetry/opentelemetry-specification/blob/v1.57.0/specification/trace/sdk.md#getsamplingintent

Can someone from the sampling SIG go and update https://github.com/open-telemetry/opentelemetry-specification/blame/efceef79720efc238645666139a7cee1b0145df1/specification/trace/sdk.md#L661 to reflect your update here? Thanks.

* (reciprocal of sampling probability, used by Span-to-Metrics estimation) reliably, because a
* non-consistent-probability sampling decision might have affected the threshold value.
*
* @return true iff the threshold can be reliably used for adjusted count calculation

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Suggested change
* @return true iff the threshold can be reliably used for adjusted count calculation
* @return true if the threshold can be reliably used for adjusted count calculation

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Is this intended to mean "If and only if"? if so, maybe better to spell it out in case someone isn't familiar with the abbreviation.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Yes, indeed. Thanks, I'll fix it later today.

@PeterF778

Copy link
Copy Markdown
Contributor Author

Can someone from the sampling SIG go and update https://github.com/open-telemetry/opentelemetry-specification/blame/efceef79720efc238645666139a7cee1b0145df1/specification/trace/sdk.md#L661 to reflect your update here? Thanks.

@jack-berg Does this change require an Issue?

@jack-berg

Copy link
Copy Markdown
Member

Yes, but just as a formality

@linux-foundation-easycla

linux-foundation-easycla Bot commented Jun 22, 2026

Copy link
Copy Markdown

CLA Signed
The committers listed above are authorized under a signed CLA.

  • ✅ login: PeterF778 / name: Peter Findeisen (b837e4c)

@otelbot otelbot Bot added the api-change Changes to public API surface area label Jun 22, 2026
@PeterF778 PeterF778 force-pushed the Restore_compliance_between_Composite_Samplers_code_and_specs branch from a2b7a68 to b837e4c Compare June 22, 2026 18:41
@otelbot otelbot Bot removed the api-change Changes to public API surface area label Jun 22, 2026
@PeterF778

Copy link
Copy Markdown
Contributor Author

I messed up the branch with my first commit this morning, so I restored it to the previous state.

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.

4 participants