mirror of
https://github.com/prometheus/prometheus.git
synced 2025-09-21 13:51:00 +02:00
promqltest: Add test to demonstrate sub-query bug with HistogramStatsIterator
To fix this, we need to make sure that HistogramStatsIterator is not used with a sub-query in the path. Signed-off-by: beorn7 <beorn@grafana.com>
This commit is contained in:
parent
0cef66b12a
commit
4e94ee0109
@ -1608,6 +1608,24 @@ eval instant at 1m histogram_quantile(0.5, myHistogram2)
|
|||||||
eval instant at 1m histogram_quantile(0.5, mixedHistogram)
|
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"
|
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
|
clear
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user