Skip to content
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

Conversation

pedro-stanaka
Copy link
Contributor

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.

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]>
@fpetkovski fpetkovski requested a review from GiedriusS October 25, 2023 13:34
Co-authored-by: Filip Petkovski <[email protected]>
Signed-off-by: Pedro Tanaka <[email protected]>
@@ -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) {
Copy link
Member

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

Copy link
Contributor Author

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]>
@pedro-stanaka
Copy link
Contributor Author

Seems like we got a flaky test, make test on my local succeeds, but not on CI. Trying an empty commit to see if succeeds.

@pedro-stanaka pedro-stanaka force-pushed the fix-extended-functions-native-histogram branch from d88151d to 2e22f8f Compare October 30, 2023 08:32
@fpetkovski fpetkovski merged commit dfb4b4f into thanos-io:main Oct 30, 2023
5 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants