From 658e9c5155e6e1cf19ca84de64db52e7defbd765 Mon Sep 17 00:00:00 2001 From: Kapil Lamba Date: Sat, 21 Jun 2025 15:16:40 +0530 Subject: [PATCH] promqltest: migrate test files to new syntax using basic mode Signed-off-by: Kapil Lamba --- promql/promqltest/testdata/aggregators.test | 121 +++++++---- promql/promqltest/testdata/at_modifier.test | 3 +- promql/promqltest/testdata/collision.test | 3 +- promql/promqltest/testdata/functions.test | 133 +++++++----- promql/promqltest/testdata/histograms.test | 33 ++- .../testdata/name_label_dropping.test | 3 +- .../testdata/native_histograms.test | 105 ++++++---- promql/promqltest/testdata/operators.test | 189 ++++++++++++------ 8 files changed, 392 insertions(+), 198 deletions(-) diff --git a/promql/promqltest/testdata/aggregators.test b/promql/promqltest/testdata/aggregators.test index 7062d37f05..fb5420d07b 100644 --- a/promql/promqltest/testdata/aggregators.test +++ b/promql/promqltest/testdata/aggregators.test @@ -235,21 +235,25 @@ eval instant at 0m max(http_requests) {} 4 # The histogram is ignored here so the result doesn't change but it has an info annotation now. -eval_info instant at 0m max({job="api-server"}) +eval instant at 0m max({job="api-server"}) + expect info {} 4 # The histogram is ignored here so there is no result but it has an info annotation now. -eval_info instant at 0m max(http_requests_histogram) +eval instant at 0m max(http_requests_histogram) + expect info eval instant at 0m min(http_requests) {} 1 # The histogram is ignored here so the result doesn't change but it has an info annotation now. -eval_info instant at 0m min({job="api-server"}) +eval instant at 0m min({job="api-server"}) + expect info {} 1 # The histogram is ignored here so there is no result but it has an info annotation now. -eval_info instant at 0m min(http_requests_histogram) +eval instant at 0m min(http_requests_histogram) + expect info eval instant at 0m max by (group) (http_requests) {group="production"} 2 @@ -276,26 +280,31 @@ load 5m http_requests_histogram{job="api-server", instance="3", group="production"} {{schema:0 sum:20 count:20}}x11 foo 1+1x9 3 -eval_ordered instant at 50m topk(3, http_requests) +eval instant at 50m topk(3, http_requests) + expect ordered http_requests{group="canary", instance="1", job="app-server"} 800 http_requests{group="canary", instance="0", job="app-server"} 700 http_requests{group="production", instance="1", job="app-server"} 600 -eval_ordered instant at 50m topk((3), (http_requests)) +eval instant at 50m topk((3), (http_requests)) + expect ordered http_requests{group="canary", instance="1", job="app-server"} 800 http_requests{group="canary", instance="0", job="app-server"} 700 http_requests{group="production", instance="1", job="app-server"} 600 -eval_ordered instant at 50m topk(5, http_requests{group="canary",job="app-server"}) +eval instant at 50m topk(5, http_requests{group="canary",job="app-server"}) + expect ordered http_requests{group="canary", instance="1", job="app-server"} 800 http_requests{group="canary", instance="0", job="app-server"} 700 -eval_ordered instant at 50m bottomk(3, http_requests) +eval instant at 50m bottomk(3, http_requests) + expect ordered http_requests{group="production", instance="0", job="api-server"} 100 http_requests{group="production", instance="1", job="api-server"} 200 http_requests{group="canary", instance="0", job="api-server"} 300 -eval_ordered instant at 50m bottomk(5, http_requests{group="canary",job="app-server"}) +eval instant at 50m bottomk(5, http_requests{group="canary",job="app-server"}) + expect ordered http_requests{group="canary", instance="0", job="app-server"} 700 http_requests{group="canary", instance="1", job="app-server"} 800 @@ -309,33 +318,39 @@ eval instant at 50m bottomk by (group) (2, http_requests) http_requests{group="production", instance="0", job="api-server"} 100 http_requests{group="production", instance="1", job="api-server"} 200 -eval_ordered instant at 50m bottomk by (group) (2, http_requests{group="production"}) +eval instant at 50m bottomk by (group) (2, http_requests{group="production"}) + expect ordered http_requests{group="production", instance="0", job="api-server"} 100 http_requests{group="production", instance="1", job="api-server"} 200 # Test NaN is sorted away from the top/bottom. -eval_ordered instant at 50m topk(3, http_requests{job="api-server",group="production"}) +eval instant at 50m topk(3, http_requests{job="api-server",group="production"}) + expect ordered http_requests{job="api-server", instance="1", group="production"} 200 http_requests{job="api-server", instance="0", group="production"} 100 http_requests{job="api-server", instance="2", group="production"} NaN -eval_ordered instant at 50m bottomk(3, http_requests{job="api-server",group="production"}) +eval instant at 50m bottomk(3, http_requests{job="api-server",group="production"}) + expect ordered http_requests{job="api-server", instance="0", group="production"} 100 http_requests{job="api-server", instance="1", group="production"} 200 http_requests{job="api-server", instance="2", group="production"} NaN # Test topk and bottomk allocate min(k, input_vector) for results vector -eval_ordered instant at 50m bottomk(9999999999, http_requests{job="app-server",group="canary"}) +eval instant at 50m bottomk(9999999999, http_requests{job="app-server",group="canary"}) + expect ordered http_requests{group="canary", instance="0", job="app-server"} 700 http_requests{group="canary", instance="1", job="app-server"} 800 -eval_ordered instant at 50m topk(9999999999, http_requests{job="api-server",group="production"}) +eval instant at 50m topk(9999999999, http_requests{job="api-server",group="production"}) + expect ordered http_requests{job="api-server", instance="1", group="production"} 200 http_requests{job="api-server", instance="0", group="production"} 100 http_requests{job="api-server", instance="2", group="production"} NaN # Bug #5276. -eval_ordered instant at 50m topk(scalar(foo), http_requests) +eval instant at 50m topk(scalar(foo), http_requests) + expect ordered http_requests{group="canary", instance="1", job="app-server"} 800 http_requests{group="canary", instance="0", job="app-server"} 700 http_requests{group="production", instance="1", job="app-server"} 600 @@ -348,42 +363,54 @@ eval range from 0m to 50m step 5m count(bottomk(scalar(foo), http_requests)) {} 1 2 3 4 5 6 7 8 9 9 3 # Tests for histogram: should ignore histograms. -eval_info instant at 50m topk(100, http_requests_histogram) +eval instant at 50m topk(100, http_requests_histogram) + expect info #empty -eval_info range from 0 to 50m step 5m topk(100, http_requests_histogram) +eval range from 0 to 50m step 5m topk(100, http_requests_histogram) + expect info #empty -eval_info instant at 50m topk(1, {__name__=~"http_requests(_histogram)?"}) +eval instant at 50m topk(1, {__name__=~"http_requests(_histogram)?"}) + expect info {__name__="http_requests", group="canary", instance="1", job="app-server"} 800 -eval_info instant at 50m count(topk(1000, {__name__=~"http_requests(_histogram)?"})) +eval instant at 50m count(topk(1000, {__name__=~"http_requests(_histogram)?"})) + expect info {} 9 -eval_info range from 0 to 50m step 5m count(topk(1000, {__name__=~"http_requests(_histogram)?"})) +eval range from 0 to 50m step 5m count(topk(1000, {__name__=~"http_requests(_histogram)?"})) + expect info {} 9x10 -eval_info instant at 50m topk by (instance) (1, {__name__=~"http_requests(_histogram)?"}) +eval instant at 50m topk by (instance) (1, {__name__=~"http_requests(_histogram)?"}) + expect info {__name__="http_requests", group="canary", instance="0", job="app-server"} 700 {__name__="http_requests", group="canary", instance="1", job="app-server"} 800 {__name__="http_requests", group="production", instance="2", job="api-server"} NaN -eval_info instant at 50m bottomk(100, http_requests_histogram) +eval instant at 50m bottomk(100, http_requests_histogram) + expect info #empty -eval_info range from 0 to 50m step 5m bottomk(100, http_requests_histogram) +eval range from 0 to 50m step 5m bottomk(100, http_requests_histogram) + expect info #empty -eval_info instant at 50m bottomk(1, {__name__=~"http_requests(_histogram)?"}) +eval instant at 50m bottomk(1, {__name__=~"http_requests(_histogram)?"}) + expect info {__name__="http_requests", group="production", instance="0", job="api-server"} 100 -eval_info instant at 50m count(bottomk(1000, {__name__=~"http_requests(_histogram)?"})) +eval instant at 50m count(bottomk(1000, {__name__=~"http_requests(_histogram)?"})) + expect info {} 9 -eval_info range from 0 to 50m step 5m count(bottomk(1000, {__name__=~"http_requests(_histogram)?"})) +eval range from 0 to 50m step 5m count(bottomk(1000, {__name__=~"http_requests(_histogram)?"})) + expect info {} 9x10 -eval_info instant at 50m bottomk by (instance) (1, {__name__=~"http_requests(_histogram)?"}) +eval instant at 50m bottomk by (instance) (1, {__name__=~"http_requests(_histogram)?"}) + expect info {__name__="http_requests", group="production", instance="0", job="api-server"} 100 {__name__="http_requests", group="production", instance="1", job="api-server"} 200 {__name__="http_requests", group="production", instance="2", job="api-server"} NaN @@ -438,8 +465,8 @@ eval instant at 1m count_values by (job, group)("job", version) {job="{count:20, sum:10, [-2,-1):2, [-1,-0.5):1, [-0.001,0.001]:2, (0.5,1]:1, (1,2]:2}", group="canary"} 2 # Test an invalid label value. -eval_fail instant at 0 count_values("a\xc5z", version) - expected_fail_message invalid label name "a\xc5z" +eval instant at 0 count_values("a\xc5z", version) + expect fail msg:invalid label name "a\xc5z" # Tests for quantile. clear @@ -462,13 +489,15 @@ eval instant at 1m quantile without(point)(0.8, data) {test="uneven samples"} 2.8 # The histogram is ignored here so the result doesn't change but it has an info annotation now. -eval_info instant at 1m quantile without(point)(0.8, {__name__=~"data(_histogram)?"}) +eval instant at 1m quantile without(point)(0.8, {__name__=~"data(_histogram)?"}) + expect info {test="two samples"} 0.8 {test="three samples"} 1.6 {test="uneven samples"} 2.8 # The histogram is ignored here so there is no result but it has an info annotation now. -eval_info instant at 1m quantile(0.8, data_histogram) +eval instant at 1m quantile(0.8, data_histogram) + expect info # Bug #5276. eval instant at 1m quantile without(point)(scalar(foo), data) @@ -681,22 +710,28 @@ load 5m series{label="c"} {{schema:1 sum:15 count:10 buckets:[3 2 5 7 9]}} # The histogram is ignored here so the result doesn't change but it has an info annotation now. -eval_info instant at 0m stddev(series) +eval instant at 0m stddev(series) + expect info {} 0.5 -eval_info instant at 0m stdvar(series) +eval instant at 0m stdvar(series) + expect info {} 0.25 # The histogram is ignored here so there is no result but it has an info annotation now. -eval_info instant at 0m stddev({label="c"}) +eval instant at 0m stddev({label="c"}) + expect info -eval_info instant at 0m stdvar({label="c"}) +eval instant at 0m stdvar({label="c"}) + expect info -eval_info instant at 0m stddev by (label) (series) +eval instant at 0m stddev by (label) (series) + expect info {label="a"} 0 {label="b"} 0 -eval_info instant at 0m stdvar by (label) (series) +eval instant at 0m stdvar by (label) (series) + expect info {label="a"} 0 {label="b"} 0 @@ -707,17 +742,21 @@ load 5m series{label="b"} 1 series{label="c"} 2 -eval_info instant at 0m stddev(series) +eval instant at 0m stddev(series) + expect info {} 0.5 -eval_info instant at 0m stdvar(series) +eval instant at 0m stdvar(series) + expect info {} 0.25 -eval_info instant at 0m stddev by (label) (series) +eval instant at 0m stddev by (label) (series) + expect info {label="b"} 0 {label="c"} 0 -eval_info instant at 0m stdvar by (label) (series) +eval instant at 0m stdvar by (label) (series) + expect info {label="b"} 0 {label="c"} 0 diff --git a/promql/promqltest/testdata/at_modifier.test b/promql/promqltest/testdata/at_modifier.test index 1ad301bdb7..754eeb9285 100644 --- a/promql/promqltest/testdata/at_modifier.test +++ b/promql/promqltest/testdata/at_modifier.test @@ -91,7 +91,8 @@ eval instant at 25s metric{job="1"} @ 50 + metric{job="1"} @ 100 {job="1"} 15 # Note that this triggers an info annotation because we are rate'ing a metric that does not end in `_total`. -eval_info instant at 25s rate(metric{job="1"}[100s] @ 100) + label_replace(rate(metric{job="2"}[123s] @ 200), "job", "1", "", "") +eval instant at 25s rate(metric{job="1"}[100s] @ 100) + label_replace(rate(metric{job="2"}[123s] @ 200), "job", "1", "", "") + expect info {job="1"} 0.3 eval instant at 25s sum_over_time(metric{job="1"}[100s] @ 100) + label_replace(sum_over_time(metric{job="2"}[100s] @ 100), "job", "1", "", "") diff --git a/promql/promqltest/testdata/collision.test b/promql/promqltest/testdata/collision.test index 4dcdfa4ddf..8addf02be9 100644 --- a/promql/promqltest/testdata/collision.test +++ b/promql/promqltest/testdata/collision.test @@ -17,6 +17,7 @@ load 5m testmetric1{src="a",dst="b"} 0 testmetric2{src="a",dst="b"} 1 -eval_fail instant at 0m ceil({__name__=~'testmetric1|testmetric2'}) +eval instant at 0m ceil({__name__=~'testmetric1|testmetric2'}) + expect fail clear diff --git a/promql/promqltest/testdata/functions.test b/promql/promqltest/testdata/functions.test index b99dcd7e0d..5c476912f3 100644 --- a/promql/promqltest/testdata/functions.test +++ b/promql/promqltest/testdata/functions.test @@ -247,13 +247,16 @@ eval instant at 20m irate(http_requests_histogram{path="/b"}[20m]) eval instant at 20m irate(http_requests_histogram{path="/b"}[6m]) -eval_warn instant at 20m irate(http_requests_histogram{path="/c"}[20m]) +eval instant at 20m irate(http_requests_histogram{path="/c"}[20m]) + expect warn {path="/c"} {{sum:0.01 count:0.01 counter_reset_hint:gauge}} -eval_warn instant at 20m irate(http_requests_histogram{path="/d"}[20m]) +eval instant at 20m irate(http_requests_histogram{path="/d"}[20m]) + expect warn {path="/d"} {{sum:0.01 count:0.01 counter_reset_hint:gauge}} -eval_warn instant at 20m irate(http_requests_histogram{path="/e"}[20m]) +eval instant at 20m irate(http_requests_histogram{path="/e"}[20m]) + expect warn eval instant at 20m irate(http_requests_histogram{path="/f"}[20m]) {path="/f"} {{schema:-53 sum:0.01 count:0.01 custom_values:[5 10] buckets:[0.01]}} @@ -279,11 +282,13 @@ 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]) +eval instant at 20m delta(http_requests_counter[20m]) + expect warn {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]) +eval instant at 20m delta(http_requests_mix[20m]) + expect warn #empty clear @@ -316,17 +321,22 @@ eval instant at 20m idelta(http_requests_histogram{path="/b"}[20m]) eval instant at 20m idelta(http_requests_histogram{path="/b"}[6m]) -eval_warn instant at 20m idelta(http_requests_histogram{path="/c"}[20m]) +eval instant at 20m idelta(http_requests_histogram{path="/c"}[20m]) + expect warn {path="/c"} {{sum:1 count:1 counter_reset_hint:gauge}} -eval_warn instant at 20m idelta(http_requests_histogram{path="/d"}[20m]) +eval instant at 20m idelta(http_requests_histogram{path="/d"}[20m]) + expect warn {path="/d"} {{sum:1 count:1 counter_reset_hint:gauge}} -eval_warn instant at 20m idelta(http_requests_histogram{path="/e"}[20m]) +eval instant at 20m idelta(http_requests_histogram{path="/e"}[20m]) + expect warn -eval_warn instant at 20m idelta(http_requests_histogram{path="/f"}[20m]) +eval instant at 20m idelta(http_requests_histogram{path="/f"}[20m]) + expect warn -eval_warn instant at 20m idelta(http_requests_histogram{path="/g"}[20m]) +eval instant at 20m idelta(http_requests_histogram{path="/g"}[20m]) + expect warn clear @@ -351,10 +361,12 @@ eval instant at 50m deriv(testcounter_reset_middle_total[100m]) {} 0.010606060606060607 # deriv should ignore histograms in a mixed range of floats and histograms, flagged by an info annotation. -eval_info instant at 110m deriv(http_requests_mix{group="canary", instance="1", job="app-server"}[110m]) +eval instant at 110m deriv(http_requests_mix{group="canary", instance="1", job="app-server"}[110m]) + expect info {group="canary", instance="1", job="app-server"} 0.26666666666666666 -eval_info instant at 100m deriv(testcounter_reset_middle_mix[110m]) +eval instant at 100m deriv(testcounter_reset_middle_mix[110m]) + expect info {} 0.010606060606060607 # deriv should silently ignore ranges consisting only of histograms. @@ -401,10 +413,12 @@ eval instant at 70m predict_linear(testcounter_reset_middle_total[55m] @ 3000, 3 {} 89.54545454545455 # predict_linear should ignore histograms in a mixed range of floats and histograms, flagged by an info annotation. -eval_info instant at 60m predict_linear(testcounter_reset_middle_mix[60m], 3000) +eval instant at 60m predict_linear(testcounter_reset_middle_mix[60m], 3000) + expect info {} 70 -eval_info instant at 60m predict_linear(testcounter_reset_middle_mix[60m], 50m) +eval instant at 60m predict_linear(testcounter_reset_middle_mix[60m], 50m) + expect info {} 70 # predict_linear should silently ignore ranges consisting only of histograms. @@ -471,13 +485,16 @@ eval instant at 0m label_replace(testmetric, "dst", "", "dst", ".*") testmetric{src="source-value-20"} 1 # label_replace fails when the regex is invalid. -eval_fail instant at 0m label_replace(testmetric, "dst", "value-$1", "src", "(.*") +eval instant at 0m label_replace(testmetric, "dst", "value-$1", "src", "(.*") + expect fail # label_replace fails when the destination label name is not a valid Prometheus label name. -eval_fail instant at 0m label_replace(testmetric, "\xff", "", "src", "(.*)") +eval instant at 0m label_replace(testmetric, "\xff", "", "src", "(.*)") + expect fail # label_replace fails when there would be duplicated identical output label sets. -eval_fail instant at 0m label_replace(testmetric, "src", "", "", "") +eval instant at 0m label_replace(testmetric, "src", "", "", "") + expect fail clear @@ -540,8 +557,8 @@ eval instant at 0m label_join(testmetric1, "dst", ", ", "src", "src1", "src2") testmetric1{src="foo",src1="bar",src2="foobar",dst="foo, bar, foobar"} 0 testmetric1{src="fizz",src1="buzz",src2="fizzbuzz",dst="fizz, buzz, fizzbuzz"} 1 -eval_fail instant at 0m label_join(dup, "label", "", "this") - expected_fail_message vector cannot contain metrics with the same labelset +eval instant at 0m label_join(dup, "label", "", "this") + expect fail msg:vector cannot contain metrics with the same labelset clear @@ -652,7 +669,8 @@ load 5m http_requests{job="app-server", instance="1", group="canary"} 0+80x10 http_requests{job="app-server", instance="2", group="canary"} {{schema:0 sum:1 count:1}}x15 -eval_ordered instant at 50m sort(http_requests) +eval instant at 50m sort(http_requests) + expect ordered http_requests{group="production", instance="0", job="api-server"} 100 http_requests{group="production", instance="1", job="api-server"} 200 http_requests{group="canary", instance="0", job="api-server"} 300 @@ -663,7 +681,8 @@ eval_ordered instant at 50m sort(http_requests) http_requests{group="canary", instance="1", job="app-server"} 800 http_requests{group="canary", instance="2", job="api-server"} NaN -eval_ordered instant at 50m sort_desc(http_requests) +eval instant at 50m sort_desc(http_requests) + expect ordered http_requests{group="canary", instance="1", job="app-server"} 800 http_requests{group="canary", instance="0", job="app-server"} 700 http_requests{group="production", instance="1", job="app-server"} 600 @@ -701,7 +720,8 @@ load 5m node_uname_info{job="node_exporter", instance="4m5", release="1.11.3"} 0+10x10 node_uname_info{job="node_exporter", instance="4m1000", release="1.111.3"} 0+10x10 -eval_ordered instant at 50m sort_by_label(http_requests, "instance") +eval instant at 50m sort_by_label(http_requests, "instance") + expect ordered http_requests{group="canary", instance="0", job="api-server"} 300 http_requests{group="canary", instance="0", job="app-server"} 700 http_requests{group="production", instance="0", job="api-server"} 100 @@ -713,7 +733,8 @@ eval_ordered instant at 50m sort_by_label(http_requests, "instance") http_requests{group="canary", instance="2", job="api-server"} NaN http_requests{group="production", instance="2", job="api-server"} 100 -eval_ordered instant at 50m sort_by_label(http_requests, "instance", "group") +eval instant at 50m sort_by_label(http_requests, "instance", "group") + expect ordered http_requests{group="canary", instance="0", job="api-server"} 300 http_requests{group="canary", instance="0", job="app-server"} 700 http_requests{group="production", instance="0", job="api-server"} 100 @@ -725,7 +746,8 @@ eval_ordered instant at 50m sort_by_label(http_requests, "instance", "group") http_requests{group="canary", instance="2", job="api-server"} NaN http_requests{group="production", instance="2", job="api-server"} 100 -eval_ordered instant at 50m sort_by_label(http_requests, "instance", "group") +eval instant at 50m sort_by_label(http_requests, "instance", "group") + expect ordered http_requests{group="canary", instance="0", job="api-server"} 300 http_requests{group="canary", instance="0", job="app-server"} 700 http_requests{group="production", instance="0", job="api-server"} 100 @@ -737,7 +759,8 @@ eval_ordered instant at 50m sort_by_label(http_requests, "instance", "group") http_requests{group="canary", instance="2", job="api-server"} NaN http_requests{group="production", instance="2", job="api-server"} 100 -eval_ordered instant at 50m sort_by_label(http_requests, "group", "instance", "job") +eval instant at 50m sort_by_label(http_requests, "group", "instance", "job") + expect ordered http_requests{group="canary", instance="0", job="api-server"} 300 http_requests{group="canary", instance="0", job="app-server"} 700 http_requests{group="canary", instance="1", job="api-server"} 400 @@ -749,7 +772,8 @@ eval_ordered instant at 50m sort_by_label(http_requests, "group", "instance", "j http_requests{group="production", instance="1", job="app-server"} 600 http_requests{group="production", instance="2", job="api-server"} 100 -eval_ordered instant at 50m sort_by_label(http_requests, "job", "instance", "group") +eval instant at 50m sort_by_label(http_requests, "job", "instance", "group") + expect ordered http_requests{group="canary", instance="0", job="api-server"} 300 http_requests{group="production", instance="0", job="api-server"} 100 http_requests{group="canary", instance="1", job="api-server"} 400 @@ -761,7 +785,8 @@ eval_ordered instant at 50m sort_by_label(http_requests, "job", "instance", "gro http_requests{group="canary", instance="1", job="app-server"} 800 http_requests{group="production", instance="1", job="app-server"} 600 -eval_ordered instant at 50m sort_by_label_desc(http_requests, "instance") +eval instant at 50m sort_by_label_desc(http_requests, "instance") + expect ordered http_requests{group="production", instance="2", job="api-server"} 100 http_requests{group="canary", instance="2", job="api-server"} NaN http_requests{group="production", instance="1", job="app-server"} 600 @@ -773,7 +798,8 @@ eval_ordered instant at 50m sort_by_label_desc(http_requests, "instance") http_requests{group="canary", instance="0", job="app-server"} 700 http_requests{group="canary", instance="0", job="api-server"} 300 -eval_ordered instant at 50m sort_by_label_desc(http_requests, "instance", "group") +eval instant at 50m sort_by_label_desc(http_requests, "instance", "group") + expect ordered http_requests{group="production", instance="2", job="api-server"} 100 http_requests{group="canary", instance="2", job="api-server"} NaN http_requests{group="production", instance="1", job="app-server"} 600 @@ -785,7 +811,8 @@ eval_ordered instant at 50m sort_by_label_desc(http_requests, "instance", "group http_requests{group="canary", instance="0", job="app-server"} 700 http_requests{group="canary", instance="0", job="api-server"} 300 -eval_ordered instant at 50m sort_by_label_desc(http_requests, "instance", "group", "job") +eval instant at 50m sort_by_label_desc(http_requests, "instance", "group", "job") + expect ordered http_requests{group="production", instance="2", job="api-server"} 100 http_requests{group="canary", instance="2", job="api-server"} NaN http_requests{group="production", instance="1", job="app-server"} 600 @@ -797,7 +824,8 @@ eval_ordered instant at 50m sort_by_label_desc(http_requests, "instance", "group http_requests{group="canary", instance="0", job="app-server"} 700 http_requests{group="canary", instance="0", job="api-server"} 300 -eval_ordered instant at 50m sort_by_label(cpu_time_total, "cpu") +eval instant at 50m sort_by_label(cpu_time_total, "cpu") + expect ordered cpu_time_total{job="cpu", cpu="0"} 100 cpu_time_total{job="cpu", cpu="1"} 100 cpu_time_total{job="cpu", cpu="2"} 100 @@ -809,12 +837,14 @@ eval_ordered instant at 50m sort_by_label(cpu_time_total, "cpu") cpu_time_total{job="cpu", cpu="21"} 100 cpu_time_total{job="cpu", cpu="100"} 100 -eval_ordered instant at 50m sort_by_label(node_uname_info, "instance") +eval instant at 50m sort_by_label(node_uname_info, "instance") + expect ordered node_uname_info{job="node_exporter", instance="4m5", release="1.11.3"} 100 node_uname_info{job="node_exporter", instance="4m600", release="1.2.3"} 100 node_uname_info{job="node_exporter", instance="4m1000", release="1.111.3"} 100 -eval_ordered instant at 50m sort_by_label(node_uname_info, "release") +eval instant at 50m sort_by_label(node_uname_info, "release") + expect ordered node_uname_info{job="node_exporter", instance="4m600", release="1.2.3"} 100 node_uname_info{job="node_exporter", instance="4m5", release="1.11.3"} 100 node_uname_info{job="node_exporter", instance="4m1000", release="1.111.3"} 100 @@ -841,7 +871,8 @@ eval instant at 8000s double_exponential_smoothing(http_requests[1m], 0.01, 0.1) {job="api-server", instance="1", group="canary"} 32000 # double_exponential_smoothing should ignore histograms in a mixed range of floats and histograms, flagged by an info annotation. -eval_info instant at 20010s double_exponential_smoothing(http_requests_mix[1m], 0.01, 0.1) +eval instant at 20010s double_exponential_smoothing(http_requests_mix[1m], 0.01, 0.1) + expect info {job="api-server", instance="0", group="production"} 30100 {job="api-server", instance="1", group="production"} 30200 {job="api-server", instance="0", group="canary"} 80300 @@ -986,10 +1017,12 @@ eval instant at 55s sum_over_time(metric11[1m])/count_over_time(metric11[1m]) {} NaN # Tests for samples with mix of floats and histograms. -eval_warn instant at 55s sum_over_time(metric12[1m]) +eval instant at 55s sum_over_time(metric12[1m]) + expect warn # no result. -eval_warn instant at 55s avg_over_time(metric12[1m]) +eval instant at 55s avg_over_time(metric12[1m]) + expect warn # no result. # Tests for samples with only histograms. @@ -1150,13 +1183,15 @@ eval instant at 1m stddev_over_time((metric[2m])) eval instant at 1m stddev_over_time(metric_histogram{type="only_histogram"}[2m]) #empty -eval_info instant at 1m stddev_over_time(metric_histogram{type="mix"}[2m]) +eval instant at 1m stddev_over_time(metric_histogram{type="mix"}[2m]) + expect info {type="mix"} 0 eval instant at 1m stdvar_over_time(metric_histogram{type="only_histogram"}[2m]) #empty -eval_info instant at 1m stdvar_over_time(metric_histogram{type="mix"}[2m]) +eval instant at 1m stdvar_over_time(metric_histogram{type="mix"}[2m]) + expect info {type="mix"} 0 # Tests for stddev_over_time and stdvar_over_time #4927. @@ -1183,7 +1218,8 @@ eval instant at 70s mad_over_time(metric[70s]) eval instant at 70s mad_over_time(metric_histogram{type="only_histogram"}[70s]) #empty -eval_info instant at 70s mad_over_time(metric_histogram{type="mix"}[70s]) +eval instant at 70s mad_over_time(metric_histogram{type="mix"}[70s]) + expect info {type="mix"} 0 # Tests for ts_of_max_over_time and ts_of_min_over_time. Using odd scrape interval to test for rounding bugs. @@ -1251,17 +1287,20 @@ eval instant at 1m quantile_over_time(1, data[2m]) {test="three samples"} 2 {test="uneven samples"} 4 -eval_warn instant at 1m quantile_over_time(-1, data[2m]) +eval instant at 1m quantile_over_time(-1, data[2m]) + expect warn {test="two samples"} -Inf {test="three samples"} -Inf {test="uneven samples"} -Inf -eval_warn instant at 1m quantile_over_time(2, data[2m]) +eval instant at 1m quantile_over_time(2, data[2m]) + expect warn {test="two samples"} +Inf {test="three samples"} +Inf {test="uneven samples"} +Inf -eval_warn instant at 1m (quantile_over_time(2, (data[2m]))) +eval instant at 1m (quantile_over_time(2, (data[2m]))) + expect warn {test="two samples"} +Inf {test="three samples"} +Inf {test="uneven samples"} +Inf @@ -1269,7 +1308,8 @@ eval_warn instant at 1m (quantile_over_time(2, (data[2m]))) eval instant at 1m quantile_over_time(0.5, data_histogram{test="only histogram samples"}[2m]) #empty -eval_info instant at 1m quantile_over_time(0.5, data_histogram{test="mix samples"}[2m]) +eval instant at 1m quantile_over_time(0.5, data_histogram{test="mix samples"}[2m]) + expect info {test="mix samples"} 1 clear @@ -1383,7 +1423,8 @@ load 5m testmetric1{src="a",dst="b"} 0 testmetric2{src="a",dst="b"} 1 -eval_fail instant at 0m changes({__name__=~'testmetric1|testmetric2'}[5m]) +eval instant at 0m changes({__name__=~'testmetric1|testmetric2'}[5m]) + expect fail clear @@ -1407,7 +1448,8 @@ eval instant at 1m min_over_time(data[2m]) eval instant at 1m min_over_time(data_histogram{type="only_histogram"}[2m]) #empty -eval_info instant at 1m min_over_time(data_histogram{type="mix_samples"}[2m]) +eval instant at 1m min_over_time(data_histogram{type="mix_samples"}[2m]) + expect info {type="mix_samples"} 0 eval instant at 1m max_over_time(data[2m]) @@ -1420,7 +1462,8 @@ eval instant at 1m max_over_time(data[2m]) eval instant at 1m max_over_time(data_histogram{type="only_histogram"}[2m]) #empty -eval_info instant at 1m max_over_time(data_histogram{type="mix_samples"}[2m]) +eval instant at 1m max_over_time(data_histogram{type="mix_samples"}[2m]) + expect info {type="mix_samples"} 1 eval instant at 1m last_over_time({__name__=~"data(_histogram)?"}[2m]) diff --git a/promql/promqltest/testdata/histograms.test b/promql/promqltest/testdata/histograms.test index 68f646dd9a..5c434f199c 100644 --- a/promql/promqltest/testdata/histograms.test +++ b/promql/promqltest/testdata/histograms.test @@ -194,31 +194,37 @@ eval instant at 50m histogram_quantile(1, testhistogram3_bucket) # Quantile too low. -eval_warn instant at 50m histogram_quantile(-0.1, testhistogram) +eval instant at 50m histogram_quantile(-0.1, testhistogram) + expect warn {start="positive"} -Inf {start="negative"} -Inf -eval_warn instant at 50m histogram_quantile(-0.1, testhistogram_bucket) +eval instant at 50m histogram_quantile(-0.1, testhistogram_bucket) + expect warn {start="positive"} -Inf {start="negative"} -Inf # Quantile too high. -eval_warn instant at 50m histogram_quantile(1.01, testhistogram) +eval instant at 50m histogram_quantile(1.01, testhistogram) + expect warn {start="positive"} +Inf {start="negative"} +Inf -eval_warn instant at 50m histogram_quantile(1.01, testhistogram_bucket) +eval instant at 50m histogram_quantile(1.01, testhistogram_bucket) + expect warn {start="positive"} +Inf {start="negative"} +Inf # Quantile invalid. -eval_warn instant at 50m histogram_quantile(NaN, testhistogram) +eval instant at 50m histogram_quantile(NaN, testhistogram) + expect warn {start="positive"} NaN {start="negative"} NaN -eval_warn instant at 50m histogram_quantile(NaN, testhistogram_bucket) +eval instant at 50m histogram_quantile(NaN, testhistogram_bucket) + expect warn {start="positive"} NaN {start="negative"} NaN @@ -481,13 +487,16 @@ load 5m nonmonotonic_bucket{le="+Inf"} 0+8x10 # Nonmonotonic buckets, triggering an info annotation. -eval_info instant at 50m histogram_quantile(0.01, nonmonotonic_bucket) +eval instant at 50m histogram_quantile(0.01, nonmonotonic_bucket) + expect info {} 0.0045 -eval_info instant at 50m histogram_quantile(0.5, nonmonotonic_bucket) +eval instant at 50m histogram_quantile(0.5, nonmonotonic_bucket) + expect info {} 8.5 -eval_info instant at 50m histogram_quantile(0.99, nonmonotonic_bucket) +eval instant at 50m histogram_quantile(0.99, nonmonotonic_bucket) + expect info {} 979.75 # Buckets with different representations of the same upper bound. @@ -522,9 +531,11 @@ load_with_nhcb 5m request_duration_seconds2_bucket{job="job1", instance="ins1", le="0.2"} 0+3x10 request_duration_seconds2_bucket{job="job1", instance="ins1", le="+Inf"} 0+4x10 -eval_fail instant at 50m histogram_quantile(0.99, {__name__=~"request_duration_seconds\\d*_bucket"}) +eval instant at 50m histogram_quantile(0.99, {__name__=~"request_duration_seconds\\d*_bucket"}) + expect fail -eval_fail instant at 50m histogram_quantile(0.99, {__name__=~"request_duration_seconds\\d*"}) +eval instant at 50m histogram_quantile(0.99, {__name__=~"request_duration_seconds\\d*"}) + expect fail # Histogram with constant buckets. load_with_nhcb 1m diff --git a/promql/promqltest/testdata/name_label_dropping.test b/promql/promqltest/testdata/name_label_dropping.test index 9af45a7324..48cdb9ba4e 100644 --- a/promql/promqltest/testdata/name_label_dropping.test +++ b/promql/promqltest/testdata/name_label_dropping.test @@ -73,7 +73,8 @@ eval instant at 10m sum by (__name__, env) (metric_total{env="1"}) # Aggregation operators by __name__ lead to duplicate labelset errors (aggregation is partitioned by not yet removed __name__ label). # This is an accidental side effect of delayed __name__ label dropping -eval_fail instant at 10m sum by (__name__) (rate({env="1"}[10m])) +eval instant at 10m sum by (__name__) (rate({env="1"}[10m])) + expect fail # Aggregation operators aggregate metrics with same labelset and to-be-dropped names. # This is an accidental side effect of delayed __name__ label dropping diff --git a/promql/promqltest/testdata/native_histograms.test b/promql/promqltest/testdata/native_histograms.test index edca4eec4b..2f57dd7c6d 100644 --- a/promql/promqltest/testdata/native_histograms.test +++ b/promql/promqltest/testdata/native_histograms.test @@ -396,7 +396,8 @@ clear load 10m histogram_quantile_1 {{schema:0 count:12 sum:100 z_bucket:2 z_bucket_w:0.001 buckets:[2 3 0 1 4]}}x1 -eval_warn instant at 10m histogram_quantile(1.001, histogram_quantile_1) +eval instant at 10m histogram_quantile(1.001, histogram_quantile_1) + expect warn {} Inf eval instant at 10m histogram_quantile(1, histogram_quantile_1) @@ -424,7 +425,8 @@ eval instant at 10m histogram_quantile(0.1, histogram_quantile_1) eval instant at 10m histogram_quantile(0, histogram_quantile_1) {} 0 -eval_warn instant at 10m histogram_quantile(-1, histogram_quantile_1) +eval instant at 10m histogram_quantile(-1, histogram_quantile_1) + expect warn {} -Inf clear @@ -433,7 +435,8 @@ clear load 10m histogram_quantile_2 {{schema:0 count:12 sum:100 z_bucket:2 z_bucket_w:0.001 n_buckets:[2 3 0 1 4]}}x1 -eval_warn instant at 10m histogram_quantile(1.001, histogram_quantile_2) +eval instant at 10m histogram_quantile(1.001, histogram_quantile_2) + expect warn {} Inf eval instant at 10m histogram_quantile(1, histogram_quantile_2) @@ -457,7 +460,8 @@ eval instant at 10m histogram_quantile(0.1, histogram_quantile_2) eval instant at 10m histogram_quantile(0, histogram_quantile_2) {} -16 -eval_warn instant at 10m histogram_quantile(-1, histogram_quantile_2) +eval instant at 10m histogram_quantile(-1, histogram_quantile_2) + expect warn {} -Inf clear @@ -468,7 +472,8 @@ clear load 10m histogram_quantile_3 {{schema:0 count:24 sum:100 z_bucket:4 z_bucket_w:0.001 buckets:[2 3 0 1 4] n_buckets:[2 3 0 1 4]}}x1 -eval_warn instant at 10m histogram_quantile(1.001, histogram_quantile_3) +eval instant at 10m histogram_quantile(1.001, histogram_quantile_3) + expect warn {} Inf eval instant at 10m histogram_quantile(1, histogram_quantile_3) @@ -507,7 +512,8 @@ eval instant at 10m histogram_quantile(0.01, histogram_quantile_3) eval instant at 10m histogram_quantile(0, histogram_quantile_3) {} -16 -eval_warn instant at 10m histogram_quantile(-1, histogram_quantile_3) +eval instant at 10m histogram_quantile(-1, histogram_quantile_3) + expect warn {} -Inf clear @@ -957,13 +963,17 @@ eval instant at 10m histogram_mul_div/float_series_0 eval instant at 10m histogram_mul_div*0/0 {} {{schema:0 count:NaN sum:NaN z_bucket_w:0.001 z_bucket:NaN}} -eval_info instant at 10m histogram_mul_div*histogram_mul_div +eval instant at 10m histogram_mul_div*histogram_mul_div + expect info -eval_info instant at 10m histogram_mul_div/histogram_mul_div +eval instant at 10m histogram_mul_div/histogram_mul_div + expect info -eval_info instant at 10m float_series_3/histogram_mul_div +eval instant at 10m float_series_3/histogram_mul_div + expect info -eval_info instant at 10m 0/histogram_mul_div +eval instant at 10m 0/histogram_mul_div + expect info clear @@ -974,13 +984,17 @@ load 10m histogram_sample {{schema:0 count:24 sum:100 z_bucket:4 z_bucket_w:0.001 buckets:[2 3 0 1 4] n_buckets:[2 3 0 1 4]}}x1 float_sample 0x1 -eval_info instant at 10m float_sample+histogram_sample +eval instant at 10m float_sample+histogram_sample + expect info -eval_info instant at 10m histogram_sample+float_sample +eval instant at 10m histogram_sample+float_sample + expect info -eval_info instant at 10m float_sample-histogram_sample +eval instant at 10m float_sample-histogram_sample + expect info -eval_info instant at 10m histogram_sample-float_sample +eval instant at 10m histogram_sample-float_sample + expect info # Counter reset only noticeable in a single bucket. load 5m @@ -1018,11 +1032,13 @@ load 30s some_metric {{schema:0 sum:1 count:1 buckets:[1] counter_reset_hint:gauge}} {{schema:0 sum:2 count:2 buckets:[2] counter_reset_hint:gauge}} {{schema:0 sum:3 count:3 buckets:[3] counter_reset_hint:gauge}} # Test the case where we only have two points for rate -eval_warn instant at 30s rate(some_metric[1m]) +eval instant at 30s rate(some_metric[1m]) + expect warn {} {{count:0.03333333333333333 sum:0.03333333333333333 buckets:[0.03333333333333333]}} # Test the case where we have more than two points for rate -eval_warn instant at 1m rate(some_metric[1m30s]) +eval instant at 1m rate(some_metric[1m30s]) + expect warn {} {{count:0.03333333333333333 sum:0.03333333333333333 buckets:[0.03333333333333333]}} clear @@ -1032,11 +1048,13 @@ load 30s some_metric {{schema:0 sum:1 count:1 buckets:[1]}} {{schema:-53 sum:1 count:1 custom_values:[5 10] buckets:[1]}} {{schema:0 sum:5 count:4 buckets:[1 2 1]}} {{schema:-53 sum:1 count:1 custom_values:[5 10] buckets:[1]}} # Start and end with exponential, with custom in the middle. -eval_warn instant at 1m rate(some_metric[1m30s]) +eval instant at 1m rate(some_metric[1m30s]) + expect warn # Should produce no results. # Start and end with custom, with exponential in the middle. -eval_warn instant at 1m30s rate(some_metric[1m30s]) +eval instant at 1m30s rate(some_metric[1m30s]) + expect warn # Should produce no results. # Start with custom, end with exponential. Return the exponential histogram divided by 30. @@ -1105,10 +1123,12 @@ load 6m # T=0: only exponential # T=6: only custom # T=12: mixed, should be ignored and emit a warning -eval_warn range from 0 to 12m step 6m sum(metric) +eval range from 0 to 12m step 6m sum(metric) + expect warn {} {{sum:7 count:5 buckets:[2 3 2]}} {{schema:-53 sum:16 count:3 custom_values:[5 10] buckets:[1 2]}} _ -eval_warn range from 0 to 12m step 6m avg(metric) +eval range from 0 to 12m step 6m avg(metric) + expect warn {} {{sum:3.5 count:2.5 buckets:[1 1.5 1]}} {{schema:-53 sum:8 count:1.5 custom_values:[5 10] buckets:[0.5 1]}} _ clear @@ -1122,10 +1142,12 @@ load 6m # T=0: incompatible, should be ignored and emit a warning # T=6: compatible # T=12: incompatible followed by compatible, should be ignored and emit a warning -eval_warn range from 0 to 12m step 6m sum(metric) +eval range from 0 to 12m step 6m sum(metric) + expect warn {} _ {{schema:-53 sum:2 count:2 custom_values:[5 10] buckets:[2]}} _ -eval_warn range from 0 to 12m step 6m avg(metric) +eval range from 0 to 12m step 6m avg(metric) + expect warn {} _ {{schema:-53 sum:1 count:1 custom_values:[5 10] buckets:[1]}} _ # Test incompatible schemas with additional aggregation operators @@ -1157,9 +1179,11 @@ eval range from 0 to 12m step 6m metric{series="1"} or ignoring(series) metric{s metric{series="2"} {{schema:-53 sum:1 count:1 custom_values:[2] buckets:[1]}} _ _ # Test incompatible schemas with arithmetic binary operators -eval_warn range from 0 to 12m step 6m metric{series="2"} + ignoring (series) metric{series="3"} +eval range from 0 to 12m step 6m metric{series="2"} + ignoring (series) metric{series="3"} + expect warn -eval_warn range from 0 to 12m step 6m metric{series="2"} - ignoring (series) metric{series="3"} +eval range from 0 to 12m step 6m metric{series="2"} - ignoring (series) metric{series="3"} + expect warn clear @@ -1174,7 +1198,8 @@ metric1{} _ {{schema:-53 count:1 sum:1 custom_values:[5 10] buckets:[1]}} eval range from 0 to 6m step 6m metric1 != metric2 metric1{} {{schema:-53 sum:1 count:1 custom_values:[2] buckets:[1]}} _ -eval_info range from 0 to 6m step 6m metric2 > metric2 +eval range from 0 to 6m step 6m metric2 > metric2 + expect info clear @@ -1184,9 +1209,11 @@ load 6m # If evaluating at 12m, the first two NHCBs have the same custom values # while the 3rd one has different ones. -eval_warn instant at 12m sum_over_time(nhcb_metric[13m]) +eval instant at 12m sum_over_time(nhcb_metric[13m]) + expect warn -eval_warn instant at 12m avg_over_time(nhcb_metric[13m]) +eval instant at 12m avg_over_time(nhcb_metric[13m]) + expect warn eval instant at 12m last_over_time(nhcb_metric[13m]) nhcb_metric{} {{schema:-53 sum:1 count:1 custom_values:[5 10] buckets:[1]}} @@ -1200,11 +1227,14 @@ eval instant at 12m present_over_time(nhcb_metric[13m]) eval instant at 12m changes(nhcb_metric[13m]) {} 1 -eval_warn instant at 12m delta(nhcb_metric[13m]) +eval instant at 12m delta(nhcb_metric[13m]) + expect warn -eval_warn instant at 12m increase(nhcb_metric[13m]) +eval instant at 12m increase(nhcb_metric[13m]) + expect warn -eval_warn instant at 12m rate(nhcb_metric[13m]) +eval instant at 12m rate(nhcb_metric[13m]) + expect warn eval instant at 12m resets(nhcb_metric[13m]) {} 1 @@ -1214,9 +1244,11 @@ eval instant at 12m resets(nhcb_metric[13m]) # works with no warning for increase() and rate(). No change # otherwise. -eval_warn instant at 18m sum_over_time(nhcb_metric[13m]) +eval instant at 18m sum_over_time(nhcb_metric[13m]) + expect warn -eval_warn instant at 18m avg_over_time(nhcb_metric[13m]) +eval instant at 18m avg_over_time(nhcb_metric[13m]) + expect warn eval instant at 18m last_over_time(nhcb_metric[13m]) nhcb_metric{} {{schema:-53 sum:1 count:1 custom_values:[5 10] buckets:[1]}} @@ -1230,7 +1262,8 @@ eval instant at 18m present_over_time(nhcb_metric[13m]) eval instant at 18m changes(nhcb_metric[13m]) {} 1 -eval_warn instant at 18m delta(nhcb_metric[13m]) +eval instant at 18m delta(nhcb_metric[13m]) + expect warn eval instant at 18m increase(nhcb_metric[13m]) {} {{schema:-53 count:1.0833333333333333 sum:1.0833333333333333 custom_values:[5 10] buckets:[1.0833333333333333]}} @@ -1257,7 +1290,8 @@ load 1m metric{group="incompatible-custom-histograms", series="1"} {{schema:-53 sum:1 count:1 custom_values:[5 10] buckets:[1]}} metric{group="incompatible-custom-histograms", series="2"} {{schema:-53 sum:1 count:1 custom_values:[2] buckets:[1]}} -eval_warn instant at 0 sum by (group) (metric) +eval instant at 0 sum by (group) (metric) + expect warn {group="just-floats"} 5 {group="just-exponential-histograms"} {{sum:5 count:7 buckets:[2 3 2]}} {group="just-custom-histograms"} {{schema:-53 sum:4 count:5 custom_values:[2] buckets:[8]}} @@ -1275,7 +1309,8 @@ load 10m eval instant at 10m sum(histogram_sum) {} {{schema:0 count:107 sum:4691.2 z_bucket:14 z_bucket_w:0.001 buckets:[3 8 2 5 3 2 2] n_buckets:[2 6 8 4 15 9 0 0 0 10 10 4]}} -eval_warn instant at 10m sum({idx="0"}) +eval instant at 10m sum({idx="0"}) + expect warn eval instant at 10m sum(histogram_sum{idx="0"} + ignoring(idx) histogram_sum{idx="1"} + ignoring(idx) histogram_sum{idx="2"} + ignoring(idx) histogram_sum{idx="3"}) {} {{schema:0 count:107 sum:4691.2 z_bucket:14 z_bucket_w:0.001 buckets:[3 8 2 5 3 2 2] n_buckets:[2 6 8 4 15 9 0 0 0 10 10 4]}} diff --git a/promql/promqltest/testdata/operators.test b/promql/promqltest/testdata/operators.test index 667989ca77..1d71acba16 100644 --- a/promql/promqltest/testdata/operators.test +++ b/promql/promqltest/testdata/operators.test @@ -289,18 +289,24 @@ eval instant at 50m http_requests_total{job="api-server", instance="0", group="p {job="api-server", instance="0", group="production"} 1 # The histogram is ignored here so the result doesn't change but it has an info annotation now. -eval_info instant at 5m {job="app-server"} == 80 +eval instant at 5m {job="app-server"} == 80 + expect info http_requests_total{group="canary", instance="1", job="app-server"} 80 -eval_info instant at 5m http_requests_histogram != 80 +eval instant at 5m http_requests_histogram != 80 + expect info -eval_info instant at 5m http_requests_histogram > 80 +eval instant at 5m http_requests_histogram > 80 + expect info -eval_info instant at 5m http_requests_histogram < 80 +eval instant at 5m http_requests_histogram < 80 + expect info -eval_info instant at 5m http_requests_histogram >= 80 +eval instant at 5m http_requests_histogram >= 80 + expect info -eval_info instant at 5m http_requests_histogram <= 80 +eval instant at 5m http_requests_histogram <= 80 + expect info # Should produce valid results in case of (in)equality between two histograms. eval instant at 5m http_requests_histogram == http_requests_histogram @@ -470,7 +476,8 @@ load 5m testmetric1{src="a",dst="b"} 0 testmetric2{src="a",dst="b"} 1 -eval_fail instant at 0m -{__name__=~'testmetric1|testmetric2'} +eval instant at 0m -{__name__=~'testmetric1|testmetric2'} + expect fail clear @@ -534,10 +541,12 @@ eval range from 0 to 24m step 6m left_histograms == right_histograms eval range from 0 to 24m step 6m left_histograms == bool right_histograms {} 1 0 _ _ _ -eval_info range from 0 to 24m step 6m left_histograms == right_floats_for_histograms +eval range from 0 to 24m step 6m left_histograms == right_floats_for_histograms + expect info # No results. -eval_info range from 0 to 24m step 6m left_histograms == bool right_floats_for_histograms +eval range from 0 to 24m step 6m left_histograms == bool right_floats_for_histograms + expect info # No results. eval range from 0 to 60m step 6m left_floats != right_floats @@ -552,10 +561,12 @@ eval range from 0 to 24m step 6m left_histograms != right_histograms eval range from 0 to 24m step 6m left_histograms != bool right_histograms {} 0 1 _ _ _ -eval_info range from 0 to 24m step 6m left_histograms != right_floats_for_histograms +eval range from 0 to 24m step 6m left_histograms != right_floats_for_histograms + expect info # No results. -eval_info range from 0 to 24m step 6m left_histograms != bool right_floats_for_histograms +eval range from 0 to 24m step 6m left_histograms != bool right_floats_for_histograms + expect info # No results. eval range from 0 to 60m step 6m left_floats > right_floats @@ -564,16 +575,20 @@ eval range from 0 to 60m step 6m left_floats > right_floats eval range from 0 to 60m step 6m left_floats > bool right_floats {} 0 _ _ _ 0 _ 1 0 0 0 0 -eval_info range from 0 to 24m step 6m left_histograms > right_histograms +eval range from 0 to 24m step 6m left_histograms > right_histograms + expect info # No results. -eval_info range from 0 to 24m step 6m left_histograms > bool right_histograms +eval range from 0 to 24m step 6m left_histograms > bool right_histograms + expect info # No results. -eval_info range from 0 to 24m step 6m left_histograms > right_floats_for_histograms +eval range from 0 to 24m step 6m left_histograms > right_floats_for_histograms + expect info # No results. -eval_info range from 0 to 24m step 6m left_histograms > bool right_floats_for_histograms +eval range from 0 to 24m step 6m left_histograms > bool right_floats_for_histograms + expect info # No results. eval range from 0 to 60m step 6m left_floats >= right_floats @@ -582,16 +597,20 @@ eval range from 0 to 60m step 6m left_floats >= right_floats eval range from 0 to 60m step 6m left_floats >= bool right_floats {} 0 _ _ _ 1 _ 1 0 0 1 1 -eval_info range from 0 to 24m step 6m left_histograms >= right_histograms +eval range from 0 to 24m step 6m left_histograms >= right_histograms + expect info # No results. -eval_info range from 0 to 24m step 6m left_histograms >= bool right_histograms +eval range from 0 to 24m step 6m left_histograms >= bool right_histograms + expect info # No results. -eval_info range from 0 to 24m step 6m left_histograms >= right_floats_for_histograms +eval range from 0 to 24m step 6m left_histograms >= right_floats_for_histograms + expect info # No results. -eval_info range from 0 to 24m step 6m left_histograms >= bool right_floats_for_histograms +eval range from 0 to 24m step 6m left_histograms >= bool right_floats_for_histograms + expect info # No results. eval range from 0 to 60m step 6m left_floats < right_floats @@ -600,16 +619,20 @@ eval range from 0 to 60m step 6m left_floats < right_floats eval range from 0 to 60m step 6m left_floats < bool right_floats {} 1 _ _ _ 0 _ 0 1 0 0 0 -eval_info range from 0 to 24m step 6m left_histograms < right_histograms +eval range from 0 to 24m step 6m left_histograms < right_histograms + expect info # No results. -eval_info range from 0 to 24m step 6m left_histograms < bool right_histograms +eval range from 0 to 24m step 6m left_histograms < bool right_histograms + expect info # No results. -eval_info range from 0 to 24m step 6m left_histograms < right_floats_for_histograms +eval range from 0 to 24m step 6m left_histograms < right_floats_for_histograms + expect info # No results. -eval_info range from 0 to 24m step 6m left_histograms < bool right_floats_for_histograms +eval range from 0 to 24m step 6m left_histograms < bool right_floats_for_histograms + expect info # No results. eval range from 0 to 60m step 6m left_floats <= right_floats @@ -618,16 +641,20 @@ eval range from 0 to 60m step 6m left_floats <= right_floats eval range from 0 to 60m step 6m left_floats <= bool right_floats {} 1 _ _ _ 1 _ 0 1 0 1 1 -eval_info range from 0 to 24m step 6m left_histograms <= right_histograms +eval range from 0 to 24m step 6m left_histograms <= right_histograms + expect info # No results. -eval_info range from 0 to 24m step 6m left_histograms <= bool right_histograms +eval range from 0 to 24m step 6m left_histograms <= bool right_histograms + expect info # No results. -eval_info range from 0 to 24m step 6m left_histograms <= right_floats_for_histograms +eval range from 0 to 24m step 6m left_histograms <= right_floats_for_histograms + expect info # No results. -eval_info range from 0 to 24m step 6m left_histograms <= bool right_floats_for_histograms +eval range from 0 to 24m step 6m left_histograms <= bool right_floats_for_histograms + expect info # No results. # Vector / scalar combinations with scalar on right side @@ -664,76 +691,100 @@ eval range from 0 to 60m step 6m left_floats == NaN eval range from 0 to 60m step 6m left_floats == bool NaN {} 0 0 _ _ 0 _ 0 0 0 0 0 -eval_info range from 0 to 24m step 6m left_histograms == 3 +eval range from 0 to 24m step 6m left_histograms == 3 + expect info # No results. -eval_info range from 0 to 24m step 6m left_histograms == 0 +eval range from 0 to 24m step 6m left_histograms == 0 + expect info # No results. -eval_info range from 0 to 24m step 6m left_histograms != 3 +eval range from 0 to 24m step 6m left_histograms != 3 + expect info # No results. -eval_info range from 0 to 24m step 6m left_histograms != 0 +eval range from 0 to 24m step 6m left_histograms != 0 + expect info # No results. -eval_info range from 0 to 24m step 6m left_histograms > 3 +eval range from 0 to 24m step 6m left_histograms > 3 + expect info # No results. -eval_info range from 0 to 24m step 6m left_histograms > 0 +eval range from 0 to 24m step 6m left_histograms > 0 + expect info # No results. -eval_info range from 0 to 24m step 6m left_histograms >= 3 +eval range from 0 to 24m step 6m left_histograms >= 3 + expect info # No results. -eval_info range from 0 to 24m step 6m left_histograms >= 0 +eval range from 0 to 24m step 6m left_histograms >= 0 + expect info # No results. -eval_info range from 0 to 24m step 6m left_histograms < 3 +eval range from 0 to 24m step 6m left_histograms < 3 + expect info # No results. -eval_info range from 0 to 24m step 6m left_histograms < 0 +eval range from 0 to 24m step 6m left_histograms < 0 + expect info # No results. -eval_info range from 0 to 24m step 6m left_histograms <= 3 +eval range from 0 to 24m step 6m left_histograms <= 3 + expect info # No results. -eval_info range from 0 to 24m step 6m left_histograms <= 0 +eval range from 0 to 24m step 6m left_histograms <= 0 + expect info # No results. -eval_info range from 0 to 24m step 6m left_histograms == bool 3 +eval range from 0 to 24m step 6m left_histograms == bool 3 + expect info # No results. -eval_info range from 0 to 24m step 6m left_histograms == bool 0 +eval range from 0 to 24m step 6m left_histograms == bool 0 + expect info # No results. -eval_info range from 0 to 24m step 6m left_histograms != bool 3 +eval range from 0 to 24m step 6m left_histograms != bool 3 + expect info # No results. -eval_info range from 0 to 24m step 6m left_histograms != bool 0 +eval range from 0 to 24m step 6m left_histograms != bool 0 + expect info # No results. -eval_info range from 0 to 24m step 6m left_histograms > bool 3 +eval range from 0 to 24m step 6m left_histograms > bool 3 + expect info # No results. -eval_info range from 0 to 24m step 6m left_histograms > bool 0 +eval range from 0 to 24m step 6m left_histograms > bool 0 + expect info # No results. -eval_info range from 0 to 24m step 6m left_histograms >= bool 3 +eval range from 0 to 24m step 6m left_histograms >= bool 3 + expect info # No results. -eval_info range from 0 to 24m step 6m left_histograms >= bool 0 +eval range from 0 to 24m step 6m left_histograms >= bool 0 + expect info # No results. -eval_info range from 0 to 24m step 6m left_histograms < bool 3 +eval range from 0 to 24m step 6m left_histograms < bool 3 + expect info # No results. -eval_info range from 0 to 24m step 6m left_histograms < bool 0 +eval range from 0 to 24m step 6m left_histograms < bool 0 + expect info # No results. -eval_info range from 0 to 24m step 6m left_histograms <= bool 3 +eval range from 0 to 24m step 6m left_histograms <= bool 3 + expect info # No results. -eval_info range from 0 to 24m step 6m left_histograms <= bool 0 +eval range from 0 to 24m step 6m left_histograms <= bool 0 + expect info # No results. # Vector / scalar combinations with scalar on left side @@ -770,40 +821,52 @@ eval range from 0 to 60m step 6m NaN == left_floats eval range from 0 to 60m step 6m NaN == bool left_floats {} 0 0 _ _ 0 _ 0 0 0 0 0 -eval_info range from 0 to 24m step 6m 3 == left_histograms +eval range from 0 to 24m step 6m 3 == left_histograms + expect info # No results. -eval_info range from 0 to 24m step 6m 0 == left_histograms +eval range from 0 to 24m step 6m 0 == left_histograms + expect info # No results. -eval_info range from 0 to 24m step 6m 3 != left_histograms +eval range from 0 to 24m step 6m 3 != left_histograms + expect info # No results. -eval_info range from 0 to 24m step 6m 0 != left_histograms +eval range from 0 to 24m step 6m 0 != left_histograms + expect info # No results. -eval_info range from 0 to 24m step 6m 3 < left_histograms +eval range from 0 to 24m step 6m 3 < left_histograms + expect info # No results. -eval_info range from 0 to 24m step 6m 0 < left_histograms +eval range from 0 to 24m step 6m 0 < left_histograms + expect info # No results. -eval_info range from 0 to 24m step 6m 3 < left_histograms +eval range from 0 to 24m step 6m 3 < left_histograms + expect info # No results. -eval_info range from 0 to 24m step 6m 0 < left_histograms +eval range from 0 to 24m step 6m 0 < left_histograms + expect info # No results. -eval_info range from 0 to 24m step 6m 3 > left_histograms +eval range from 0 to 24m step 6m 3 > left_histograms + expect info # No results. -eval_info range from 0 to 24m step 6m 0 > left_histograms +eval range from 0 to 24m step 6m 0 > left_histograms + expect info # No results. -eval_info range from 0 to 24m step 6m 3 >= left_histograms +eval range from 0 to 24m step 6m 3 >= left_histograms + expect info # No results. -eval_info range from 0 to 24m step 6m 0 >= left_histograms +eval range from 0 to 24m step 6m 0 >= left_histograms + expect info # No results. clear