Merge pull request #13474 from fpetkovski/hist-last-over-time

Fix last_over_time for native histograms
This commit is contained in:
Björn Rabenstein 2024-01-26 23:28:58 +01:00 committed by GitHub
commit 88d07c43cb
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 12 additions and 1 deletions

View file

@ -603,7 +603,7 @@ func funcLastOverTime(vals []parser.Value, args parser.Expressions, enh *EvalNod
} }
return append(enh.Out, Sample{ return append(enh.Out, Sample{
Metric: el.Metric, Metric: el.Metric,
H: h.H, H: h.H.Copy(),
}), nil }), nil
} }

View file

@ -224,3 +224,14 @@ eval instant at 5m histogram_fraction(0, 4, balanced_histogram)
# the first populated bucket after the span of empty buckets. # the first populated bucket after the span of empty buckets.
eval instant at 5m histogram_quantile(0.5, balanced_histogram) eval instant at 5m histogram_quantile(0.5, balanced_histogram)
{} 0.5 {} 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