Fix the statsdreceiver summary point calculation #6155
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Description:
The statsdreceiver has incorrect handling of sample-rate information, particularly when computing summary values. The existing support, which divides the observed value by the sample rate, is incorrect. This fixes the code to use a weighted calculation of the quantiles, which corrects the problem.
Note as discussed in #5742 this receiver is making incorrect use of the StartTime field for the sum and count fields, which are ostensibly cumulative but are in fact reset with every period. This PR makes the receiver use the so-called "degenerate" cumulative temporality, meaning to report deltas as cumulatives w/ repeatedly resetting start time. This is technically much more correct than the existing behavior, which sent cumulative values as delta temporality.
Uses
gonum.org/v1/gonum/stat
for the math bits.Link to tracking Issue:
Fixes #5252. As discussed in #5742, a related solution here will be to use the new exponential histogram with automatic scaling.
Testing:
A unit test was added for correctly calculated quantiles from weighted data.
Documentation: No user-visible changes.