-
Notifications
You must be signed in to change notification settings - Fork 309
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 experimental priority sampling config as sampling rules #732
Conversation
peers: ['foo'], | ||
sampler: { | ||
sampleRate: 1, | ||
rateLimit: 1000, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🙄
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
😕
@@ -87,6 +98,48 @@ class PrioritySampler { | |||
} | |||
} | |||
} | |||
|
|||
_isSampledByRule (context, rule) { | |||
const sampled = this._limiter.isAllowed() && rule.sampler.isSampled(context) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this is backwards, we want to only apply the limit on p1 traces
const sampled = this._limiter.isAllowed() && rule.sampler.isSampled(context) | ||
|
||
context._metrics[SAMPLING_LIMIT_DECISION] = this._limiter.effectiveRate() | ||
context._metrics[SAMPLING_RULE_DECISION] = rule.sampleRate |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
we only want to set these if we used that method for sampling.
e.g.
context._metrics[SAMPLING_RULE_DECISION] = rule.sampleRate
if (!rule.sampler.isSampled(context)) return false
const sampled = this._limiter.isAllowed()
context._metrics[SAMPLING_LIMIT_DECISION] = this._limiter.effectiveRate()
return sampled
(ish)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The reason for that is so we can debug why a span was sampled or not. e.g. if we see SAMPLING_RULE_DECISION
only, then we can assume it was a p0 because of the rule, not because of rate limiter.
What does this PR do?
Add priority sampling configuration as sampling rules.
Motivation
Right now the sample rates are provided by the agent and cannot be configured, which is incompatible with Tracing Without Limits. By adding a configuration, it becomes possible to override the agent and take the sample rate decision in the tracer.