From 8d5236f9273fb0be9c55c84a9e089b59b51d8946 Mon Sep 17 00:00:00 2001 From: Neeraj Gartia <80708727+NeerajGartia21@users.noreply.github.com> Date: Fri, 20 Dec 2024 04:22:26 +0530 Subject: [PATCH] PromQL: Adds tests for `delta` with histograms (#15674) PromQL: Adds tests for delta with histograms Signed-off-by: Neeraj Gartia -------- Signed-off-by: Neeraj Gartia --- promql/promqltest/testdata/functions.test | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/promql/promqltest/testdata/functions.test b/promql/promqltest/testdata/functions.test index 7bba44869e..fb84f8bd24 100644 --- a/promql/promqltest/testdata/functions.test +++ b/promql/promqltest/testdata/functions.test @@ -234,11 +234,25 @@ clear load 5m http_requests{path="/foo"} 0 50 100 150 200 http_requests{path="/bar"} 200 150 100 50 0 + http_requests_gauge{path="/foo"} {{schema:0 sum:0 count:0 buckets:[0 0 0] counter_reset_hint:gauge}}+{{schema:0 sum:1 count:2 buckets:[1 1 1] counter_reset_hint:gauge}}x5 + http_requests_counter{path="/foo"} {{schema:0 sum:0 count:0 buckets:[0 0 0]}}+{{schema:0 sum:1 count:2 buckets:[1 1 1]}}x5 + http_requests_mix{path="/foo"} 0 50 100 {{schema:0 sum:0 count:0 buckets:[0 0 0] counter_reset_hint:gauge}} {{schema:0 sum:1 count:2 buckets:[1 1 1] counter_reset_hint:gauge}} eval instant at 20m delta(http_requests[20m]) {path="/foo"} 200 {path="/bar"} -200 +eval instant at 20m delta(http_requests_gauge[20m]) + {path="/foo"} {{schema:0 sum:4 count:8 buckets:[4 4 4]}} + +# delta emits warn annotation for non-gauge histogram types. +eval_warn instant at 20m delta(http_requests_counter[20m]) + {path="/foo"} {{schema:0 sum:4 count:8 buckets:[4 4 4]}} + +# delta emits warn annotation for mix of histogram and floats. +eval_warn instant at 20m delta(http_requests_mix[20m]) + #empty + clear # Tests for idelta().