MaxDataPoints consolidation improvements: support nudging for consistent bucketing #842
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.
Brings in these features: grafana#146
NudgeStartTimeOnAggregation
I've described the purpose of this in the code. Here's a copy of the relevant parts:
TLDR: if the consolidation is done naively (as it is being done now) , the same data point can be assigned to different buckets depending on the start time of the series. This can cause jitter in graphs when refreshing constantly.
This is done by graphite web here: https://github.com/graphite-project/graphite-web/blob/dca59dc72ae28ffdae659232c10c60aa598536eb/webapp/graphite/render/views.py#L225
and by Metrictank here: https://github.com/grafana/metrictank/blob/309ba74749c4fd8c60950929ff0719af8abc0799/consolidation/consolidate.go#L26
My implementation and tests are mainly inspired on Metrictank.
UseBucketsHighestTimestampOnAggregation
Additionally,
UseBucketsHighestTimestampOnAggregation
let's the user configure the bucket's timestimes in such way that the upper bound is used instead of the lower bound. This was also done by Metrictank, and its purpose is to avoid results from appearing to predict the future (i.e. a spike in "real time" ts=6 could be moved to a ts=4).Both of these features are disabled by default for now to avoid unexpected changes on upgrades.
Some videos showing this:
CarbonAPI with nudging disabled
carbonapi_no_nudge_.mp4
Notice the sudden change when the values change buckets
CarbonAPI with nudging enabled
carbonapi_nudge.mp4
Metrictank's version (which was my ground truth here)
mt_nudge.mp4