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

Probability sampling in tracestate specification #2047

Merged
merged 67 commits into from
Jan 26, 2022

Conversation

jmacd
Copy link
Contributor

@jmacd jmacd commented Oct 20, 2021

Changes

Specifies how to interpret and use p-value and r-value for consistent probability sampling decisions, including two optional samplers named ConsistentProbabilityBased and ConsistentParentProbabilityBased.

Does not modify existing built-in Sampler definitions.

This is ready for general review.

Implemented in open-telemetry/opentelemetry-go-contrib#1379

OTEPs
https://github.com/open-telemetry/oteps/blob/main/text/trace/0168-sampling-propagation.md
https://github.com/open-telemetry/oteps/blob/main/text/trace/0170-sampling-probability.md

Part of #1414
Part of #1412
Part of #1524
Part of #570
Another take on #1899
Fixes #2224
Part of #2179

@jmacd
Copy link
Contributor Author

jmacd commented Oct 20, 2021

@oertl @dyladan @carlosalberto Please take a look at this draft. I'm expecting at least the two of us vendors to supply implementations of this, while we continue to explore ways of adding sampling support into the traceparent.
@ocelotl Please take a look, I've tried to format this in the manner prescribed by #1210 and implemented in #2003.

@jmacd jmacd marked this pull request as ready for review November 2, 2021 08:57
@jmacd jmacd requested review from a team November 2, 2021 08:57
@jmacd
Copy link
Contributor Author

jmacd commented Nov 2, 2021

@open-telemetry/specs-trace-approvers the two optional samplers specified here are implemented by this PR in opentelemetry-go-contrib: open-telemetry/opentelemetry-go-contrib#1379

Copy link
Contributor

@ocelotl ocelotl left a comment

Choose a reason for hiding this comment

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

Changing to comment instead of requesting changes since these are not critical changes needed.

@jmacd
Copy link
Contributor Author

jmacd commented Jan 24, 2022

@open-telemetry/specs-trace-approvers This meets our minimum criteria for merging. I have been trying to get more stamps of approval, but it's not happening (or not happening quickly). I propose to merge this PR.

Copy link
Member

@mtwo mtwo 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, a bit long but that's likely necessary given the topic. I couldn't find an example for what I suspect might be a common scenario: when an edge service uses a probability-based sampler but a downstream service decides to sample when it sees a trace with a sampled flag OR some other condition is satisfied (an error, for example).

I think (?) that this is similar to the "interoperability with TraceIDRatioBased sampler" example, though the second sampler in that case uses different criteria.

@jmacd
Copy link
Contributor Author

jmacd commented Jan 26, 2022

@mtwo There isn't an exact example corresponding to your question. The section "Example: Probability and non-probability sampler in a root context" comes close, and there is a related discussion in #2179. As discussed in the issue, a better Delegating sampler API would be nice, but is not critical to the answer here. Sampler API details aside (it's a bit messy, we could use a v2 API proposal to clear things up--see #2179), the child span is expected to have adjusted count equal to the parent when the span is sampled, and adjusted count 0 when the parent was not sampled but there were errors (p=63).

@carlosalberto
Copy link
Contributor

We have more than enough reviews and no standing questions. Let's merge this now and address any improvements in future PRs.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area:sampling Related to trace sampling
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Support for probability sampling at-a-glance