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

Add dynamic sampler support to rules based samplers #317

Merged
merged 13 commits into from
Sep 29, 2021

Conversation

puckpuck
Copy link
Contributor

Which problem is this PR solving?

The RulesBased sample is exclusive to the other samplers. This PR allows you to use Dynamic and EMADynamic samplers to determine the sample rate of a RulesBased sampler rule.

Short description of the changes

This adds a new Downstream option to a rule configuration. This option can be used to contain either a DynamicSampler or EMADynamicSampler option that is a complete configuration of their respective samplers. When defined the downstream sampler will be used to determine the sample rate when all rule conditions are matched.

A popular use case is to use RulesBased sampling to keep all error and long duration traces while using a dynamic sampler for all other data, based on key fields.

Closes #283

notes:

  • I'm not sure the word Downstream is the right one here. Naming things is hard.
  • I would also prefer to have just the initial option contain the entire downstream sampler config, without having to wrap it into another config option. However, because of Go's strong typing, this doesn't seem possible without significant re-architecture of how the config is parsed for all samplers.

@puckpuck puckpuck requested a review from a team September 15, 2021 02:19
@MikeGoldsmith MikeGoldsmith self-assigned this Sep 16, 2021
Copy link
Contributor

@MikeGoldsmith MikeGoldsmith left a comment

Choose a reason for hiding this comment

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

This looks really nice and is a great start.

It's a shame we can't use sample.Sampler as the type in RulesBasedSamplerRule because it introduces a circular dependency. Maybe that's something we can look at resolving.

I'd like to see the sampler creation moved to Start and a couple of other suggestions.

config/sampler_config.go Outdated Show resolved Hide resolved
sample/rules.go Show resolved Hide resolved
sample/rules.go Outdated Show resolved Hide resolved
@MikeGoldsmith MikeGoldsmith added the type: enhancement New feature or request label Sep 23, 2021
@puckpuck
Copy link
Contributor Author

I added Start() to the sample.Sampler interface. All samplers called this anyhow, and it allowed to simplify the code when moving all initialization to the rule start.

I also added support for the TotalThroughput sampler, based on a comment thread in Slack.

Copy link
Contributor

@MikeGoldsmith MikeGoldsmith left a comment

Choose a reason for hiding this comment

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

Looks great, thanks @puckpuck 👍🏻

@MikeGoldsmith MikeGoldsmith merged commit 76b9477 into main Sep 29, 2021
@MikeGoldsmith MikeGoldsmith deleted the puckpuck.complex-rules branch September 29, 2021 11:39
@robbkidd robbkidd added the version: bump minor A PR that adds behavior, but is backwards-compatible. label Sep 29, 2021
MikeGoldsmith added a commit that referenced this pull request Oct 1, 2021
…i-arch-docker

* 'main' of github.com:honeycombio/refinery:
  Add dynamic sampler support to rules based samplers (#317)
ghost pushed a commit to opsramp/tracing-proxy that referenced this pull request Jul 5, 2024
The RulesBased sample is exclusive to the other samplers. This PR allows you to use Dynamic and EMADynamic samplers to determine the sample rate of a RulesBased sampler rule.

Co-authored-by: Mike Goldsmth <goldsmith.mike@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type: enhancement New feature or request version: bump minor A PR that adds behavior, but is backwards-compatible.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Feature Request: Support Rules based & Dynamics Samplers on single dataset
3 participants