-
Notifications
You must be signed in to change notification settings - Fork 524
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 tail-based sampling discarding low throughput and low sample rate traces #11642
Conversation
@@ -224,7 +224,7 @@ func (g *traceGroup) finalizeSampledTraces(traceIDs []string, ingestRateDecayFac | |||
|
|||
// Resize the reservoir, so that it can hold the desired fraction of | |||
// the observed ingest rate. | |||
newReservoirSize := int(math.Round(g.samplingFraction * g.ingestRate)) | |||
newReservoirSize := int(math.Ceil(g.samplingFraction * g.ingestRate)) |
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.
[For reviewer] I don't think this is needed for the fix to work, and that we have a min size. But might be good to be consistent and use math.Ceil in all samplingFraction multiplication.
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.
LGTM, thank you
… traces (#11642) In tail-based sampling, use math.ceil instead of math.Round when computing desired total such that on low throughput and low sample rate traces e.g. throughput=1, sample rate = 0.4, desired total = math.Ceil(1 * 0.4) = 1 as opposed to 0 when using math.Round. This will fix cases where these traces were missing before the fix. (cherry picked from commit b0e8925) # Conflicts: # changelogs/head.asciidoc
… traces (#11642) (#11644) In tail-based sampling, use math.ceil instead of math.Round when computing desired total such that on low throughput and low sample rate traces e.g. throughput=1, sample rate = 0.4, desired total = math.Ceil(1 * 0.4) = 1 as opposed to 0 when using math.Round. This will fix cases where these traces were missing before the fix. (cherry picked from commit b0e8925) # Conflicts: # changelogs/head.asciidoc Co-authored-by: Carson Ip <carsonip@users.noreply.github.com>
Tested successfully on |
Motivation/summary
In tail-based sampling, use math.ceil instead of math.Round when computing desired total such that on low throughput and low sample rate traces e.g. throughput=1, sample rate = 0.4, desired total = math.Ceil(1 * 0.4) = 1 as opposed to 0 when using math.Round. This will fix cases where these traces were missing before the fix.
Checklist
apmpackage
have been made)For functional changes, consider:
How to test these changes
Enable TBS, set sample rate to 0.4, send 1 trace. Check if the trace shows up.
Related issues
Closes #11372