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

Fix buffer corruption issue of last_over_time with native histograms #13470

Conversation

krajorama
Copy link
Member

@krajorama krajorama commented Jan 25, 2024

The test defined by

# Add histogram to test sum(last_over_time) regression
load 5m
    incr_sum_histogram{number="1"} {{schema:0 sum:0 count:0 buckets:[1]}}+{{schema:0 sum:1 count:1 buckets:[1]}}x10
    incr_sum_histogram{number="2"} {{schema:0 sum:0 count:0 buckets:[1]}}+{{schema:0 sum:2 count:1 buckets:[1]}}x10

eval instant at 50m histogram_sum(sum(incr_sum_histogram))
    {} 30

eval instant at 50m histogram_sum(sum(last_over_time(incr_sum_histogram[5m])))
    {} 30

Should pass, but results in

error in eval histogram_sum(sum(last_over_time(incr_sum_histogram[1m]))) (line 237): expected 30 for {} but got 40

Works before #13340

Signed-off-by: György Krajcsovits <gyorgy.krajcsovits@grafana.com>
@krajorama krajorama marked this pull request as draft January 25, 2024 18:43
@krajorama
Copy link
Member Author

Note: if I change the line
from

ss.Histograms = append(ss.Histograms, HPoint{H: outVec[0].H, T: ts})

to

ss.Histograms = append(ss.Histograms, HPoint{H: outVec[0].H.Copy(), T: ts})

The problem goes away, but I don't understand yet why.

@krajorama
Copy link
Member Author

proper fix in related PR

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.

None yet

1 participant