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 last_over_time for native histograms #13474

Merged
merged 1 commit into from
Jan 26, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
2 changes: 1 addition & 1 deletion promql/functions.go
Original file line number Diff line number Diff line change
Expand Up @@ -603,7 +603,7 @@ func funcLastOverTime(vals []parser.Value, args parser.Expressions, enh *EvalNod
}
return append(enh.Out, Sample{
Metric: el.Metric,
H: h.H,
H: h.H.Copy(),
}), nil
}

Expand Down
11 changes: 11 additions & 0 deletions promql/testdata/native_histograms.test
Original file line number Diff line number Diff line change
Expand Up @@ -224,3 +224,14 @@ eval instant at 5m histogram_fraction(0, 4, balanced_histogram)
# the first populated bucket after the span of empty buckets.
eval instant at 5m histogram_quantile(0.5, balanced_histogram)
{} 0.5

# 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