From eb3ea163fac32b0c14457c51facede7a77264fdf Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bj=C3=B6rn=20Rabenstein?= Date: Thu, 10 Jul 2025 15:44:02 +0200 Subject: [PATCH] promqltest: add tests for `histogram_count(increase(...))` (#16854) As `histogram_count` is playing tricks to improve performance, we better make sure that the limitation of extrapolation below zero still works as expected. Signed-off-by: beorn7 --- promql/promqltest/testdata/native_histograms.test | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/promql/promqltest/testdata/native_histograms.test b/promql/promqltest/testdata/native_histograms.test index b223e90c30..3ade4b5354 100644 --- a/promql/promqltest/testdata/native_histograms.test +++ b/promql/promqltest/testdata/native_histograms.test @@ -1416,3 +1416,16 @@ eval instant at 55m increase(metric[55m15s]) eval instant at 54m30s increase(metric[54m45s]) {type="histogram"} {{count:2509.375 sum:50.69444444444444 counter_reset_hint:gauge buckets:[10.13888888888889 2499.236111111111]}} {type="counter"} 2509.375 + +# Try the same, but now extract just the histogram count via `histogram_count`. +eval instant at 55m histogram_count(increase(metric[90m])) + {type="histogram"} 2490 + +eval instant at 54m30s histogram_count(increase(metric[90m])) + {type="histogram"} 2512.9166666666665 + +eval instant at 55m histogram_count(increase(metric[55m15s])) + {type="histogram"} 2486.25 + +eval instant at 54m30s histogram_count(increase(metric[54m45s])) + {type="histogram"} 2509.375