Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Composite Head Samplers #4321

Open
wants to merge 5 commits into
base: main
Choose a base branch
from

Conversation

PeterF778
Copy link

@PeterF778 PeterF778 commented Dec 4, 2024

Changes

Migrating from open-telemetry/oteps#250.

This is another approach for introducing Composite (Head) Samplers. The previous one (open-telemetry/oteps#240) proved too large, with some controversial elements.
This OTEP is a split-off from that one, focusing just on one area - new Composite Samplers.

Two prototypes exist for this functionality. We are seeking a third prototype.

In the Java-contrib repo: https://github.com/open-telemetry/opentelemetry-java-contrib/blob/main/consistent-sampling/README.md

In @jmacd's https://github.com/jmacd/go-sampler/blob/main/README.md.

@carlosalberto carlosalberto added the OTEP OpenTelemetry Enhancement Proposal (OTEP) label Dec 5, 2024
Copy link

This PR was marked stale due to lack of activity. It will be closed in 7 days.

@github-actions github-actions bot added the Stale label Dec 12, 2024
@PeterF778 PeterF778 marked this pull request as draft December 14, 2024 01:14
@PeterF778
Copy link
Author

Added IsAdjustedCountReliable to SamplingIntent, as discussed by the Sampling SIG.

@github-actions github-actions bot removed the Stale label Dec 14, 2024
Copy link

This PR was marked stale due to lack of activity. It will be closed in 7 days.

Copy link

github-actions bot commented Jan 4, 2025

Closed as inactive. Feel free to reopen if this PR is still being worked on.

@jmacd jmacd requested a review from oertl January 23, 2025 16:06
@PeterF778 PeterF778 marked this pull request as ready for review January 23, 2025 16:21
Copy link
Contributor

@yuanyuanzhao3 yuanyuanzhao3 left a comment

Choose a reason for hiding this comment

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

I made a pass through. I will need to read again the last part of this PR after getting one or two questions clarified. Thanks for the work.


- The THRESHOLD value represented as a 14-character hexadecimal string, with value of `null` representing non-probabilistic `DROP` decision (implementations MAY use different representation, if it appears more performant or convenient),
- A function (`IsAdjustedCountReliable`) that provides a `boolean` value indicating that the adjusted count (calculated as reciprocal of the sampling probability) can be faithfully used to estimate span metrics,
- A function (`GetAttributes`) that provides a set of `Attributes` to be added to the `Span` in case of positive final sampling decision,
Copy link
Contributor

Choose a reason for hiding this comment

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

Nit: "a positive final sampling decision".

- The THRESHOLD value represented as a 14-character hexadecimal string, with value of `null` representing non-probabilistic `DROP` decision (implementations MAY use different representation, if it appears more performant or convenient),
- A function (`IsAdjustedCountReliable`) that provides a `boolean` value indicating that the adjusted count (calculated as reciprocal of the sampling probability) can be faithfully used to estimate span metrics,
- A function (`GetAttributes`) that provides a set of `Attributes` to be added to the `Span` in case of positive final sampling decision,
- A function (`UpdateTraceState`) that given an input `Tracestate` and sampling Decision provides a `Tracestate` to be associated with the `Span`. The samplers SHOULD NOT add or modify the `th` value for the `ot` key within these functions.
Copy link
Contributor

Choose a reason for hiding this comment

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

Nit: add comma before "provides".

- The THRESHOLD value represented as a 14-character hexadecimal string, with value of `null` representing non-probabilistic `DROP` decision (implementations MAY use different representation, if it appears more performant or convenient),
- A function (`IsAdjustedCountReliable`) that provides a `boolean` value indicating that the adjusted count (calculated as reciprocal of the sampling probability) can be faithfully used to estimate span metrics,
- A function (`GetAttributes`) that provides a set of `Attributes` to be added to the `Span` in case of positive final sampling decision,
- A function (`UpdateTraceState`) that given an input `Tracestate` and sampling Decision provides a `Tracestate` to be associated with the `Span`. The samplers SHOULD NOT add or modify the `th` value for the `ot` key within these functions.
Copy link
Contributor

Choose a reason for hiding this comment

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

I wasn't able to get this UpdateTraceState function at first, in particular, why the sampler cannot change the th value. Reading further and thinking more, it seems to me that this function is intended for the sampler implementation to add some vendor-specific info? The sampler can change the th value as part of its processing of ShouldSample.

If my guess is right, can we state the intended use of this function? That will help the implementors of the SDK or the samplers.

If my guess is not right, can you explain?


The Predicates represent logical expressions which can access `Span` `Attributes` (or anything else available when the sampling decision is to be made), and perform tests on the accessible values.
For example, one can test if the target URL for a SERVER span matches a given pattern.
`Predicate` interface allows users to create custom categories based on information that is available at the time of making the sampling decision.
Copy link
Contributor

Choose a reason for hiding this comment

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

I think it's worth to state that the predicates should be independent on the sampling decisions.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
changelog.opentelemetry.io OTEP OpenTelemetry Enhancement Proposal (OTEP)
Projects
None yet
Development

Successfully merging this pull request may close these issues.

8 participants