-
Notifications
You must be signed in to change notification settings - Fork 57
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
Emit error when querying native histograms with extended functions #322
Emit error when querying native histograms with extended functions #322
Conversation
We saw panics on our setup because users tried to use the extended functions with native histograms, which led to rates calculated with only one sample in some windows. In this PR I am introducing a safeguard against this type of situation and emiting a warn when users try to query native histograms with extended functions. Signed-off-by: Pedro Tanaka <[email protected]> Fixing test case Signed-off-by: Pedro Tanaka <[email protected]> removing dead code Signed-off-by: Pedro Tanaka <[email protected]> Return error instead of warn Signed-off-by: Pedro Tanaka <[email protected]> fixing linting Signed-off-by: Pedro Tanaka <[email protected]>
Co-authored-by: Filip Petkovski <[email protected]> Signed-off-by: Pedro Tanaka <[email protected]>
execution/scan/matrix_selector.go
Outdated
@@ -351,8 +353,9 @@ loop: | |||
// into the [mint, maxt] range are retained; only points with later timestamps | |||
// are populated from the iterator. | |||
// TODO(fpetkovski): Add max samples limit. | |||
func selectExtPoints(it *storage.BufferedSeriesIterator, mint, maxt int64, out []Sample, extLookbackDelta int64, metricAppearedTs **int64) ([]Sample, error) { | |||
func selectExtPoints(ctx context.Context, it *storage.BufferedSeriesIterator, mint, maxt int64, out []Sample, extLookbackDelta int64, metricAppearedTs **int64) ([]Sample, error) { |
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.
Why this context was added here? Seems like an unrelated change
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.
Good catch, I was using the context before to attach warns, but we saw it was better to return an error altogether.
Signed-off-by: Pedro Tanaka <[email protected]>
Seems like we got a flaky test, |
d88151d
to
2e22f8f
Compare
We saw panics on our setup because users tried to use the extended functions with native histograms, which led to rates calculated with only one sample in some windows.
In this PR I am introducing a safeguard against this type of situation and emiting an error when users try to query native histograms with extended functions.