Skip to content
This repository has been archived by the owner on Aug 23, 2023. It is now read-only.

Fix NormalizeTo bug: prepend correct amount of points to pre-canonicalize series #1813

Merged
merged 2 commits into from
Apr 30, 2020

Conversation

shanson7
Copy link
Collaborator

fixes #1812

The basic issue here is that we weren't prepending enough NaN to fill out a series before calling consolidate. For the example in the test we had timestamps:

[ 45, 60, 75, 90, 105, 135 ] that we want to normalize to 60 second data. This means turning 4 points into 1. For consolidate to act on the proper time boundaries 15-60 and 75-105, we need to pad extra timestamps in the front to make [ 15, 30, 45, 60, 75, 90, 105, 135 ]

Unfortunately, the current code uses the output interval (60) not the input interval (15) as the step, so it would only ever prepend 0 or 1 timestamps.

Copy link
Contributor

@Dieterbe Dieterbe left a comment

Choose a reason for hiding this comment

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

nice catch. kindof impressive how this bug managed to not trip the existing test cases.

@Dieterbe Dieterbe changed the title Fix NormalizeTo Fix NormalizeTo bug: prepend correct amount of points to pre-canonicalize series Apr 30, 2020
@Dieterbe Dieterbe merged commit 3fc06c9 into grafana:master Apr 30, 2020
@shanson7 shanson7 deleted the fix_normalizeto branch April 30, 2020 10:15
@shanson7 shanson7 mentioned this pull request May 20, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

NormalizeTo does incorrect consolidation
2 participants