-
Notifications
You must be signed in to change notification settings - Fork 1
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
Align series by step in *seriesLists functions if steps or value length not equal #99
Conversation
This comment has been minimized.
This comment has been minimized.
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.
looks good, just a small comment regarding the step calculation
also nit: can we update the name of the PR so it reflects the fact that this also takes care of different lengths? for future reference
@@ -133,6 +132,7 @@ func (f *seriesList) Do(ctx context.Context, e parser.Expr, from, until int64, v | |||
} | |||
|
|||
var denominator *types.MetricData | |||
step, alignStep := helper.GetCommonStep(append(numerators, denominators...)) |
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.
I think the step
should be calculated for each pair of series and not for all of them
if alignStep || len(numerator.Values) != len(denominator.Values) { | ||
alignedSeries := helper.ScaleToCommonStep(types.CopyMetricDataSlice([]*types.MetricData{numerator, denominator}), step) | ||
numerator = alignedSeries[0] | ||
denominator = alignedSeries[1] |
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.
Following up on my other comment, I think I would calculate the step
and alignStep
here:
pair := []*types.MetricData{numerator, denominator})
step, alignStep := helper.GetCommonStep(pair)
if alignStep || len(numerator.Values) != len(denominator.Values) {
....
This comment has been minimized.
This comment has been minimized.
1c62824
to
b18fcce
Compare
Go coverage report: Click to expand.
Go lint report: No issues found. 😎 |
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!
…th not equal (#99) Align series by step in divideBySeries if steps not equal
This PR addresses a bug with the *seriesLists functions, such as divideSeriesList. This function has been returning an error if the step times of the numerator and denominator are not equal, or if the length of the values in each series are not equal. This is not consistent with Graphite web's implementation, which finds the LCM of the step and then consolidates based on that step time. The numerators and denominators should now be aligned by step, and should be aligned when the number of values are different, and no error should be returned for mismatched step times or value lengths between series.