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

Fix ProbabilitySampler #322

Merged
merged 2 commits into from
Aug 21, 2020
Merged

Fix ProbabilitySampler #322

merged 2 commits into from
Aug 21, 2020

Conversation

fbogsany
Copy link
Contributor

open-telemetry/opentelemetry-specification#704 simplified the probability sampler, relying on parent_or_else to respect the parent context's sampled flag, if required. This PR updates the probability sampler accordingly.

#321 highlighted that actually setting the sampler to something other than the default is cumbersome. There are 2 levels of complexity here:

  1. indirection through the TracerProvider's active trace config
  2. deep nesting of modules.

This also fixes 2. above by adding a few helpers for the common cases of parent_or_else delegating to one of the standard samplers. E.g.

delegate = OpenTelemetry::SDK::Trace::Samplers.probability(0.001)
OpenTelemetry::SDK::Trace::Samplers.parent_or_else(delegate)

becomes:

OpenTelemetry::SDK::Trace::Samplers.parent_or_probability(0.001)

Copy link
Member

@mwear mwear left a comment

Choose a reason for hiding this comment

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

LGTM

@fbogsany fbogsany merged commit 7a10db9 into master Aug 21, 2020
@fbogsany fbogsany deleted the fix-probability-sampler branch August 21, 2020 17:25
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.

2 participants