diff --git a/promql/promqltest/testdata/native_histograms.test b/promql/promqltest/testdata/native_histograms.test index 0958b8951e..eb8cfb3432 100644 --- a/promql/promqltest/testdata/native_histograms.test +++ b/promql/promqltest/testdata/native_histograms.test @@ -1608,6 +1608,24 @@ eval instant at 1m histogram_quantile(0.5, myHistogram2) eval instant at 1m histogram_quantile(0.5, mixedHistogram) expect warn msg: PromQL warning: vector contains a mix of classic and native histograms for metric name "mixedHistogram" +clear + +# A counter reset only in a bucket. Sub-queries still need to detect +# it via explicit counter reset detection. This test also runs it with +# histogram_count in the expression to make sure that the +# HistogramStatsIterator is not used. (The latter fails to correctly +# do the counter resets because Seek is used with sub-queries. And the +# explicit counter reset detection done with sub-queries cannot access +# the buckets anymore, if HistogramStatsIterator is used.) +load 1m + h{} {{schema:0 count:1 sum:10 buckets:[1]}}+{{}}x20 {{schema:0 count:1 sum:10 buckets:[0 1]}}+{{}}x20 + +# Both evals below should yield the same value for the count. +eval instant at 41m histogram_count(increase(h[40m:9m])) + {} 1.4814814814814814 + +eval instant at 41m increase(h[40m:9m]) + {} {{count:1.4814814814814814 sum:14.814814814814813 counter_reset_hint:gauge offset:1 buckets:[1.4814814814814814]}} clear