Browse Source

promqltest: Complete the tests for info annotations (#15429)

promqltest: Complete the tests for info annotations

So far, we did not test for the _absence_ of an info annotation
(because many tests triggered info annotations, which we haven't taken
into account so far).

The test for info annotations was also missed for range queries.

This completes the tests for info annotations (and refactors the many
`if` statements into a somewhat more compact `switch` statement).

It fixes most tests to not emit an info annotation anymore. Or it
changes the `eval` to `eval_info` where we actually want to test for
the info annotation.

It also fixes a few spelling errors in comments.

---------

Signed-off-by: beorn7 <beorn@grafana.com>
Signed-off-by: Björn Rabenstein <github@rabenste.in>
Co-authored-by: Arve Knudsen <arve.knudsen@gmail.com>
pull/15428/merge
Björn Rabenstein 13 hours ago committed by GitHub
parent
commit
125a90899c
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
  1. 30
      promql/engine_test.go
  2. 23
      promql/promqltest/test.go
  3. 12
      promql/promqltest/testdata/aggregators.test
  4. 3
      promql/promqltest/testdata/at_modifier.test
  5. 138
      promql/promqltest/testdata/functions.test
  6. 8
      promql/promqltest/testdata/histograms.test
  7. 96
      promql/promqltest/testdata/name_label_dropping.test
  8. 234
      promql/promqltest/testdata/operators.test
  9. 172
      promql/promqltest/testdata/selectors.test
  10. 84
      promql/promqltest/testdata/subquery.test

30
promql/engine_test.go

@ -3494,51 +3494,51 @@ func TestEvaluationWithDelayedNameRemovalDisabled(t *testing.T) {
promqltest.RunTest(t, `
load 5m
metric{env="1"} 0 60 120
metric_total{env="1"} 0 60 120
another_metric{env="1"} 60 120 180
# Does not drop __name__ for vector selector
eval instant at 10m metric{env="1"}
metric{env="1"} 120
eval instant at 10m metric_total{env="1"}
metric_total{env="1"} 120
# Drops __name__ for unary operators
eval instant at 10m -metric
eval instant at 10m -metric_total
{env="1"} -120
# Drops __name__ for binary operators
eval instant at 10m metric + another_metric
eval instant at 10m metric_total + another_metric
{env="1"} 300
# Does not drop __name__ for binary comparison operators
eval instant at 10m metric <= another_metric
metric{env="1"} 120
eval instant at 10m metric_total <= another_metric
metric_total{env="1"} 120
# Drops __name__ for binary comparison operators with "bool" modifier
eval instant at 10m metric <= bool another_metric
eval instant at 10m metric_total <= bool another_metric
{env="1"} 1
# Drops __name__ for vector-scalar operations
eval instant at 10m metric * 2
eval instant at 10m metric_total * 2
{env="1"} 240
# Drops __name__ for instant-vector functions
eval instant at 10m clamp(metric, 0, 100)
eval instant at 10m clamp(metric_total, 0, 100)
{env="1"} 100
# Drops __name__ for round function
eval instant at 10m round(metric)
eval instant at 10m round(metric_total)
{env="1"} 120
# Drops __name__ for range-vector functions
eval instant at 10m rate(metric{env="1"}[10m])
eval instant at 10m rate(metric_total{env="1"}[10m])
{env="1"} 0.2
# Does not drop __name__ for last_over_time function
eval instant at 10m last_over_time(metric{env="1"}[10m])
metric{env="1"} 120
eval instant at 10m last_over_time(metric_total{env="1"}[10m])
metric_total{env="1"} 120
# Drops name for other _over_time functions
eval instant at 10m max_over_time(metric{env="1"}[10m])
eval instant at 10m max_over_time(metric_total{env="1"}[10m])
{env="1"} 120
`, engine)
}

23
promql/promqltest/test.go

@ -1097,12 +1097,16 @@ func (t *test) execRangeEval(cmd *evalCmd, engine promql.QueryEngine) error {
if res.Err == nil && cmd.fail {
return fmt.Errorf("expected error evaluating query %q (line %d) but got none", cmd.expr, cmd.line)
}
countWarnings, _ := res.Warnings.CountWarningsAndInfo()
if !cmd.warn && countWarnings > 0 {
countWarnings, countInfo := res.Warnings.CountWarningsAndInfo()
switch {
case !cmd.warn && countWarnings > 0:
return fmt.Errorf("unexpected warnings evaluating query %q (line %d): %v", cmd.expr, cmd.line, res.Warnings)
}
if cmd.warn && countWarnings == 0 {
case cmd.warn && countWarnings == 0:
return fmt.Errorf("expected warnings evaluating query %q (line %d) but got none", cmd.expr, cmd.line)
case !cmd.info && countInfo > 0:
return fmt.Errorf("unexpected info annotations evaluating query %q (line %d): %v", cmd.expr, cmd.line, res.Warnings)
case cmd.info && countInfo == 0:
return fmt.Errorf("expected info annotations evaluating query %q (line %d) but got none", cmd.expr, cmd.line)
}
defer q.Close()
@ -1148,13 +1152,14 @@ func (t *test) runInstantQuery(iq atModifierTestCase, cmd *evalCmd, engine promq
return fmt.Errorf("expected error evaluating query %q (line %d) but got none", iq.expr, cmd.line)
}
countWarnings, countInfo := res.Warnings.CountWarningsAndInfo()
if !cmd.warn && countWarnings > 0 {
switch {
case !cmd.warn && countWarnings > 0:
return fmt.Errorf("unexpected warnings evaluating query %q (line %d): %v", iq.expr, cmd.line, res.Warnings)
}
if cmd.warn && countWarnings == 0 {
case cmd.warn && countWarnings == 0:
return fmt.Errorf("expected warnings evaluating query %q (line %d) but got none", iq.expr, cmd.line)
}
if cmd.info && countInfo == 0 {
case !cmd.info && countInfo > 0:
return fmt.Errorf("unexpected info annotations evaluating query %q (line %d): %v", iq.expr, cmd.line, res.Warnings)
case cmd.info && countInfo == 0:
return fmt.Errorf("expected info annotations evaluating query %q (line %d) but got none", iq.expr, cmd.line)
}
err = cmd.compareResult(res.Value)

12
promql/promqltest/testdata/aggregators.test vendored

@ -624,11 +624,11 @@ eval_info instant at 0m stddev({label="c"})
eval_info instant at 0m stdvar({label="c"})
eval instant at 0m stddev by (label) (series)
eval_info instant at 0m stddev by (label) (series)
{label="a"} 0
{label="b"} 0
eval instant at 0m stdvar by (label) (series)
eval_info instant at 0m stdvar by (label) (series)
{label="a"} 0
{label="b"} 0
@ -639,17 +639,17 @@ load 5m
series{label="b"} 1
series{label="c"} 2
eval instant at 0m stddev(series)
eval_info instant at 0m stddev(series)
{} 0.5
eval instant at 0m stdvar(series)
eval_info instant at 0m stdvar(series)
{} 0.25
eval instant at 0m stddev by (label) (series)
eval_info instant at 0m stddev by (label) (series)
{label="b"} 0
{label="c"} 0
eval instant at 0m stdvar by (label) (series)
eval_info instant at 0m stdvar by (label) (series)
{label="b"} 0
{label="c"} 0

3
promql/promqltest/testdata/at_modifier.test vendored

@ -90,7 +90,8 @@ eval instant at 25s sum_over_time(metric{job="1"}[100] offset 50s @ 100)
eval instant at 25s metric{job="1"} @ 50 + metric{job="1"} @ 100
{job="1"} 15
eval instant at 25s rate(metric{job="1"}[100s] @ 100) + label_replace(rate(metric{job="2"}[123s] @ 200), "job", "1", "", "")
# 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", "", "")
{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", "", "")

138
promql/promqltest/testdata/functions.test vendored

@ -83,13 +83,13 @@ clear
# Tests for increase().
load 5m
http_requests{path="/foo"} 0+10x10
http_requests{path="/bar"} 0+18x5 0+18x5
http_requests{path="/dings"} 10+10x10
http_requests{path="/bumms"} 1+10x10
http_requests_total{path="/foo"} 0+10x10
http_requests_total{path="/bar"} 0+18x5 0+18x5
http_requests_total{path="/dings"} 10+10x10
http_requests_total{path="/bumms"} 1+10x10
# Tests for increase().
eval instant at 50m increase(http_requests[50m])
eval instant at 50m increase(http_requests_total[50m])
{path="/foo"} 100
{path="/bar"} 160
{path="/dings"} 100
@ -102,7 +102,7 @@ eval instant at 50m increase(http_requests[50m])
# chosen. However, "bumms" has value 1 at t=0 and would reach 0 at
# t=-30s. Here the extrapolation to t=-2m30s would reach a negative
# value, and therefore the extrapolation happens only by 30s.
eval instant at 50m increase(http_requests[100m])
eval instant at 50m increase(http_requests_total[100m])
{path="/foo"} 100
{path="/bar"} 162
{path="/dings"} 105
@ -115,57 +115,57 @@ clear
# So the sequence 3 2 (decreasing counter = reset) is interpreted the same as 3 0 1 2.
# Prometheus assumes it missed the intermediate values 0 and 1.
load 5m
http_requests{path="/foo"} 0 1 2 3 2 3 4
http_requests_total{path="/foo"} 0 1 2 3 2 3 4
eval instant at 30m increase(http_requests[30m])
eval instant at 30m increase(http_requests_total[30m])
{path="/foo"} 7
clear
# Tests for rate().
load 5m
testcounter_reset_middle 0+27x4 0+27x5
testcounter_reset_end 0+10x9 0 10
testcounter_reset_middle_total 0+27x4 0+27x5
testcounter_reset_end_total 0+10x9 0 10
# Counter resets at in the middle of range are handled correctly by rate().
eval instant at 50m rate(testcounter_reset_middle[50m])
eval instant at 50m rate(testcounter_reset_middle_total[50m])
{} 0.08
# Counter resets at end of range are ignored by rate().
eval instant at 50m rate(testcounter_reset_end[5m])
eval instant at 50m rate(testcounter_reset_end_total[5m])
eval instant at 50m rate(testcounter_reset_end[6m])
eval instant at 50m rate(testcounter_reset_end_total[6m])
{} 0
clear
load 5m
calculate_rate_offset{x="a"} 0+10x10
calculate_rate_offset{x="b"} 0+20x10
calculate_rate_window 0+80x10
calculate_rate_offset_total{x="a"} 0+10x10
calculate_rate_offset_total{x="b"} 0+20x10
calculate_rate_window_total 0+80x10
# Rates should calculate per-second rates.
eval instant at 50m rate(calculate_rate_window[50m])
eval instant at 50m rate(calculate_rate_window_total[50m])
{} 0.26666666666666666
eval instant at 50m rate(calculate_rate_offset[10m] offset 5m)
eval instant at 50m rate(calculate_rate_offset_total[10m] offset 5m)
{x="a"} 0.03333333333333333
{x="b"} 0.06666666666666667
clear
load 4m
testcounter_zero_cutoff{start="0m"} 0+240x10
testcounter_zero_cutoff{start="1m"} 60+240x10
testcounter_zero_cutoff{start="2m"} 120+240x10
testcounter_zero_cutoff{start="3m"} 180+240x10
testcounter_zero_cutoff{start="4m"} 240+240x10
testcounter_zero_cutoff{start="5m"} 300+240x10
testcounter_zero_cutoff_total{start="0m"} 0+240x10
testcounter_zero_cutoff_total{start="1m"} 60+240x10
testcounter_zero_cutoff_total{start="2m"} 120+240x10
testcounter_zero_cutoff_total{start="3m"} 180+240x10
testcounter_zero_cutoff_total{start="4m"} 240+240x10
testcounter_zero_cutoff_total{start="5m"} 300+240x10
# Zero cutoff for left-side extrapolation happens until we
# reach half a sampling interval (2m). Beyond that, we only
# extrapolate by half a sampling interval.
eval instant at 10m rate(testcounter_zero_cutoff[20m])
eval instant at 10m rate(testcounter_zero_cutoff_total[20m])
{start="0m"} 0.5
{start="1m"} 0.55
{start="2m"} 0.6
@ -174,7 +174,7 @@ eval instant at 10m rate(testcounter_zero_cutoff[20m])
{start="5m"} 0.6
# Normal half-interval cutoff for left-side extrapolation.
eval instant at 50m rate(testcounter_zero_cutoff[20m])
eval instant at 50m rate(testcounter_zero_cutoff_total[20m])
{start="0m"} 0.6
{start="1m"} 0.6
{start="2m"} 0.6
@ -186,15 +186,15 @@ clear
# Tests for irate().
load 5m
http_requests{path="/foo"} 0+10x10
http_requests{path="/bar"} 0+10x5 0+10x5
http_requests_total{path="/foo"} 0+10x10
http_requests_total{path="/bar"} 0+10x5 0+10x5
eval instant at 50m irate(http_requests[50m])
eval instant at 50m irate(http_requests_total[50m])
{path="/foo"} .03333333333333333333
{path="/bar"} .03333333333333333333
# Counter reset.
eval instant at 30m irate(http_requests[50m])
eval instant at 30m irate(http_requests_total[50m])
{path="/foo"} .03333333333333333333
{path="/bar"} 0
@ -224,18 +224,18 @@ clear
# Tests for deriv() and predict_linear().
load 5m
testcounter_reset_middle 0+10x4 0+10x5
http_requests{job="app-server", instance="1", group="canary"} 0+80x10
testcounter_reset_middle_total 0+10x4 0+10x5
http_requests_total{job="app-server", instance="1", group="canary"} 0+80x10
# deriv should return the same as rate in simple cases.
eval instant at 50m rate(http_requests{group="canary", instance="1", job="app-server"}[50m])
eval instant at 50m rate(http_requests_total{group="canary", instance="1", job="app-server"}[50m])
{group="canary", instance="1", job="app-server"} 0.26666666666666666
eval instant at 50m deriv(http_requests{group="canary", instance="1", job="app-server"}[50m])
eval instant at 50m deriv(http_requests_total{group="canary", instance="1", job="app-server"}[50m])
{group="canary", instance="1", job="app-server"} 0.26666666666666666
# deriv should return correct result.
eval instant at 50m deriv(testcounter_reset_middle[100m])
eval instant at 50m deriv(testcounter_reset_middle_total[100m])
{} 0.010606060606060607
# predict_linear should return correct result.
@ -252,31 +252,31 @@ eval instant at 50m deriv(testcounter_reset_middle[100m])
# intercept at t=0: 6.818181818181818
# intercept at t=3000: 38.63636363636364
# intercept at t=3000+3600: 76.81818181818181
eval instant at 50m predict_linear(testcounter_reset_middle[50m], 3600)
eval instant at 50m predict_linear(testcounter_reset_middle_total[50m], 3600)
{} 70
eval instant at 50m predict_linear(testcounter_reset_middle[50m], 1h)
eval instant at 50m predict_linear(testcounter_reset_middle_total[50m], 1h)
{} 70
# intercept at t = 3000+3600 = 6600
eval instant at 50m predict_linear(testcounter_reset_middle[55m] @ 3000, 3600)
eval instant at 50m predict_linear(testcounter_reset_middle_total[55m] @ 3000, 3600)
{} 76.81818181818181
eval instant at 50m predict_linear(testcounter_reset_middle[55m] @ 3000, 1h)
eval instant at 50m predict_linear(testcounter_reset_middle_total[55m] @ 3000, 1h)
{} 76.81818181818181
# intercept at t = 600+3600 = 4200
eval instant at 10m predict_linear(testcounter_reset_middle[55m] @ 3000, 3600)
eval instant at 10m predict_linear(testcounter_reset_middle_total[55m] @ 3000, 3600)
{} 51.36363636363637
# intercept at t = 4200+3600 = 7800
eval instant at 70m predict_linear(testcounter_reset_middle[55m] @ 3000, 3600)
eval instant at 70m predict_linear(testcounter_reset_middle_total[55m] @ 3000, 3600)
{} 89.54545454545455
# With http_requests, there is a sample value exactly at the end of
# With http_requests_total, there is a sample value exactly at the end of
# the range, and it has exactly the predicted value, so predict_linear
# can be emulated with deriv.
eval instant at 50m predict_linear(http_requests[50m], 3600) - (http_requests + deriv(http_requests[50m]) * 3600)
eval instant at 50m predict_linear(http_requests_total[50m], 3600) - (http_requests_total + deriv(http_requests_total[50m]) * 3600)
{group="canary", instance="1", job="app-server"} 0
clear
@ -1073,49 +1073,49 @@ eval instant at 50m absent(rate(nonexistant[5m]))
clear
# Testdata for absent_over_time()
eval instant at 1m absent_over_time(http_requests[5m])
eval instant at 1m absent_over_time(http_requests_total[5m])
{} 1
eval instant at 1m absent_over_time(http_requests{handler="/foo"}[5m])
eval instant at 1m absent_over_time(http_requests_total{handler="/foo"}[5m])
{handler="/foo"} 1
eval instant at 1m absent_over_time(http_requests{handler!="/foo"}[5m])
eval instant at 1m absent_over_time(http_requests_total{handler!="/foo"}[5m])
{} 1
eval instant at 1m absent_over_time(http_requests{handler="/foo", handler="/bar", handler="/foobar"}[5m])
eval instant at 1m absent_over_time(http_requests_total{handler="/foo", handler="/bar", handler="/foobar"}[5m])
{} 1
eval instant at 1m absent_over_time(rate(nonexistant[5m])[5m:])
{} 1
eval instant at 1m absent_over_time(http_requests{handler="/foo", handler="/bar", instance="127.0.0.1"}[5m])
eval instant at 1m absent_over_time(http_requests_total{handler="/foo", handler="/bar", instance="127.0.0.1"}[5m])
{instance="127.0.0.1"} 1
load 1m
http_requests{path="/foo",instance="127.0.0.1",job="httpd"} 1+1x10
http_requests{path="/bar",instance="127.0.0.1",job="httpd"} 1+1x10
http_requests_total{path="/foo",instance="127.0.0.1",job="httpd"} 1+1x10
http_requests_total{path="/bar",instance="127.0.0.1",job="httpd"} 1+1x10
httpd_handshake_failures_total{instance="127.0.0.1",job="node"} 1+1x15
httpd_log_lines_total{instance="127.0.0.1",job="node"} 1
ssl_certificate_expiry_seconds{job="ingress"} NaN NaN NaN NaN NaN
eval instant at 5m absent_over_time(http_requests[5m])
eval instant at 5m absent_over_time(http_requests_total[5m])
eval instant at 5m absent_over_time(rate(http_requests[5m])[5m:1m])
eval instant at 5m absent_over_time(rate(http_requests_total[5m])[5m:1m])
eval instant at 0m absent_over_time(httpd_log_lines_total[30s])
eval instant at 1m absent_over_time(httpd_log_lines_total[30s])
{} 1
eval instant at 15m absent_over_time(http_requests[5m])
eval instant at 15m absent_over_time(http_requests_total[5m])
{} 1
eval instant at 15m absent_over_time(http_requests[10m])
eval instant at 15m absent_over_time(http_requests_total[10m])
eval instant at 16m absent_over_time(http_requests[6m])
eval instant at 16m absent_over_time(http_requests_total[6m])
{} 1
eval instant at 16m absent_over_time(http_requests[16m])
eval instant at 16m absent_over_time(http_requests_total[16m])
eval instant at 16m absent_over_time(httpd_handshake_failures_total[1m])
{} 1
@ -1143,30 +1143,30 @@ eval instant at 10m absent_over_time({job="ingress"}[4m])
clear
# Testdata for present_over_time()
eval instant at 1m present_over_time(http_requests[5m])
eval instant at 1m present_over_time(http_requests_total[5m])
eval instant at 1m present_over_time(http_requests{handler="/foo"}[5m])
eval instant at 1m present_over_time(http_requests_total{handler="/foo"}[5m])
eval instant at 1m present_over_time(http_requests{handler!="/foo"}[5m])
eval instant at 1m present_over_time(http_requests_total{handler!="/foo"}[5m])
eval instant at 1m present_over_time(http_requests{handler="/foo", handler="/bar", handler="/foobar"}[5m])
eval instant at 1m present_over_time(http_requests_total{handler="/foo", handler="/bar", handler="/foobar"}[5m])
eval instant at 1m present_over_time(rate(nonexistant[5m])[5m:])
eval instant at 1m present_over_time(http_requests{handler="/foo", handler="/bar", instance="127.0.0.1"}[5m])
eval instant at 1m present_over_time(http_requests_total{handler="/foo", handler="/bar", instance="127.0.0.1"}[5m])
load 1m
http_requests{path="/foo",instance="127.0.0.1",job="httpd"} 1+1x10
http_requests{path="/bar",instance="127.0.0.1",job="httpd"} 1+1x10
http_requests_total{path="/foo",instance="127.0.0.1",job="httpd"} 1+1x10
http_requests_total{path="/bar",instance="127.0.0.1",job="httpd"} 1+1x10
httpd_handshake_failures_total{instance="127.0.0.1",job="node"} 1+1x15
httpd_log_lines_total{instance="127.0.0.1",job="node"} 1
ssl_certificate_expiry_seconds{job="ingress"} NaN NaN NaN NaN NaN
eval instant at 5m present_over_time(http_requests[5m])
eval instant at 5m present_over_time(http_requests_total[5m])
{instance="127.0.0.1", job="httpd", path="/bar"} 1
{instance="127.0.0.1", job="httpd", path="/foo"} 1
eval instant at 5m present_over_time(rate(http_requests[5m])[5m:1m])
eval instant at 5m present_over_time(rate(http_requests_total[5m])[5m:1m])
{instance="127.0.0.1", job="httpd", path="/bar"} 1
{instance="127.0.0.1", job="httpd", path="/foo"} 1
@ -1175,15 +1175,15 @@ eval instant at 0m present_over_time(httpd_log_lines_total[30s])
eval instant at 1m present_over_time(httpd_log_lines_total[30s])
eval instant at 15m present_over_time(http_requests[5m])
eval instant at 15m present_over_time(http_requests_total[5m])
eval instant at 15m present_over_time(http_requests[10m])
eval instant at 15m present_over_time(http_requests_total[10m])
{instance="127.0.0.1", job="httpd", path="/bar"} 1
{instance="127.0.0.1", job="httpd", path="/foo"} 1
eval instant at 16m present_over_time(http_requests[6m])
eval instant at 16m present_over_time(http_requests_total[6m])
eval instant at 16m present_over_time(http_requests[16m])
eval instant at 16m present_over_time(http_requests_total[16m])
{instance="127.0.0.1", job="httpd", path="/bar"} 1
{instance="127.0.0.1", job="httpd", path="/foo"} 1

8
promql/promqltest/testdata/histograms.test vendored

@ -452,14 +452,14 @@ load 5m
nonmonotonic_bucket{le="1000"} 0+9x10
nonmonotonic_bucket{le="+Inf"} 0+8x10
# Nonmonotonic buckets
eval instant at 50m histogram_quantile(0.01, nonmonotonic_bucket)
# Nonmonotonic buckets, triggering an info annotation.
eval_info instant at 50m histogram_quantile(0.01, nonmonotonic_bucket)
{} 0.0045
eval instant at 50m histogram_quantile(0.5, nonmonotonic_bucket)
eval_info instant at 50m histogram_quantile(0.5, nonmonotonic_bucket)
{} 8.5
eval instant at 50m histogram_quantile(0.99, nonmonotonic_bucket)
eval_info instant at 50m histogram_quantile(0.99, nonmonotonic_bucket)
{} 979.75
# Buckets with different representations of the same upper bound.

96
promql/promqltest/testdata/name_label_dropping.test vendored

@ -1,88 +1,88 @@
# Test for __name__ label drop.
load 5m
metric{env="1"} 0 60 120
another_metric{env="1"} 60 120 180
metric_total{env="1"} 0 60 120
another_metric_total{env="1"} 60 120 180
# Does not drop __name__ for vector selector
eval instant at 10m metric{env="1"}
metric{env="1"} 120
# Does not drop __name__ for vector selector.
eval instant at 10m metric_total{env="1"}
metric_total{env="1"} 120
# Drops __name__ for unary operators
eval instant at 10m -metric
# Drops __name__ for unary operators.
eval instant at 10m -metric_total
{env="1"} -120
# Drops __name__ for binary operators
eval instant at 10m metric + another_metric
# Drops __name__ for binary operators.
eval instant at 10m metric_total + another_metric_total
{env="1"} 300
# Does not drop __name__ for binary comparison operators
eval instant at 10m metric <= another_metric
metric{env="1"} 120
# Does not drop __name__ for binary comparison operators.
eval instant at 10m metric_total <= another_metric_total
metric_total{env="1"} 120
# Drops __name__ for binary comparison operators with "bool" modifier
eval instant at 10m metric <= bool another_metric
# Drops __name__ for binary comparison operators with "bool" modifier.
eval instant at 10m metric_total <= bool another_metric_total
{env="1"} 1
# Drops __name__ for vector-scalar operations
eval instant at 10m metric * 2
# Drops __name__ for vector-scalar operations.
eval instant at 10m metric_total * 2
{env="1"} 240
# Drops __name__ for instant-vector functions
eval instant at 10m clamp(metric, 0, 100)
# Drops __name__ for instant-vector functions.
eval instant at 10m clamp(metric_total, 0, 100)
{env="1"} 100
# Drops __name__ for round function
eval instant at 10m round(metric)
# Drops __name__ for round function.
eval instant at 10m round(metric_total)
{env="1"} 120
# Drops __name__ for range-vector functions
eval instant at 10m rate(metric{env="1"}[10m])
# Drops __name__ for range-vector functions.
eval instant at 10m rate(metric_total{env="1"}[10m])
{env="1"} 0.2
# Does not drop __name__ for last_over_time function
eval instant at 10m last_over_time(metric{env="1"}[10m])
metric{env="1"} 120
# Does not drop __name__ for last_over_time function.
eval instant at 10m last_over_time(metric_total{env="1"}[10m])
metric_total{env="1"} 120
# Drops name for other _over_time functions
eval instant at 10m max_over_time(metric{env="1"}[10m])
# Drops name for other _over_time functions.
eval instant at 10m max_over_time(metric_total{env="1"}[10m])
{env="1"} 120
# Allows relabeling (to-be-dropped) __name__ via label_replace
# Allows relabeling (to-be-dropped) __name__ via label_replace.
eval instant at 10m label_replace(rate({env="1"}[10m]), "my_name", "rate_$1", "__name__", "(.+)")
{my_name="rate_metric", env="1"} 0.2
{my_name="rate_another_metric", env="1"} 0.2
{my_name="rate_metric_total", env="1"} 0.2
{my_name="rate_another_metric_total", env="1"} 0.2
# Allows preserving __name__ via label_replace
# Allows preserving __name__ via label_replace.
eval instant at 10m label_replace(rate({env="1"}[10m]), "__name__", "rate_$1", "__name__", "(.+)")
rate_metric{env="1"} 0.2
rate_another_metric{env="1"} 0.2
rate_metric_total{env="1"} 0.2
rate_another_metric_total{env="1"} 0.2
# Allows relabeling (to-be-dropped) __name__ via label_join
# Allows relabeling (to-be-dropped) __name__ via label_join.
eval instant at 10m label_join(rate({env="1"}[10m]), "my_name", "_", "__name__")
{my_name="metric", env="1"} 0.2
{my_name="another_metric", env="1"} 0.2
{my_name="metric_total", env="1"} 0.2
{my_name="another_metric_total", env="1"} 0.2
# Allows preserving __name__ via label_join
# Allows preserving __name__ via label_join.
eval instant at 10m label_join(rate({env="1"}[10m]), "__name__", "_", "__name__", "env")
metric_1{env="1"} 0.2
another_metric_1{env="1"} 0.2
metric_total_1{env="1"} 0.2
another_metric_total_1{env="1"} 0.2
# Does not drop metric names fro aggregation operators
eval instant at 10m sum by (__name__, env) (metric{env="1"})
metric{env="1"} 120
# Does not drop metric names from aggregation operators.
eval instant at 10m sum by (__name__, env) (metric_total{env="1"})
metric_total{env="1"} 120
# Aggregation operators by __name__ lead to duplicate labelset errors (aggregation is partitioned by not yet removed __name__ label)
# 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]))
# Aggregation operators aggregate metrics with same labelset and to-be-dropped names
# Aggregation operators aggregate metrics with same labelset and to-be-dropped names.
# This is an accidental side effect of delayed __name__ label dropping
eval instant at 10m sum(rate({env="1"}[10m])) by (env)
{env="1"} 0.4
# Aggregationk operators propagate __name__ label dropping information
eval instant at 10m topk(10, sum by (__name__, env) (metric{env="1"}))
metric{env="1"} 120
# Aggregationk operators propagate __name__ label dropping information.
eval instant at 10m topk(10, sum by (__name__, env) (metric_total{env="1"}))
metric_total{env="1"} 120
eval instant at 10m topk(10, sum by (__name__, env) (rate(metric{env="1"}[10m])))
eval instant at 10m topk(10, sum by (__name__, env) (rate(metric_total{env="1"}[10m])))
{env="1"} 0.2

234
promql/promqltest/testdata/operators.test vendored

@ -1,12 +1,12 @@
load 5m
http_requests{job="api-server", instance="0", group="production"} 0+10x10
http_requests{job="api-server", instance="1", group="production"} 0+20x10
http_requests{job="api-server", instance="0", group="canary"} 0+30x10
http_requests{job="api-server", instance="1", group="canary"} 0+40x10
http_requests{job="app-server", instance="0", group="production"} 0+50x10
http_requests{job="app-server", instance="1", group="production"} 0+60x10
http_requests{job="app-server", instance="0", group="canary"} 0+70x10
http_requests{job="app-server", instance="1", group="canary"} 0+80x10
http_requests_total{job="api-server", instance="0", group="production"} 0+10x10
http_requests_total{job="api-server", instance="1", group="production"} 0+20x10
http_requests_total{job="api-server", instance="0", group="canary"} 0+30x10
http_requests_total{job="api-server", instance="1", group="canary"} 0+40x10
http_requests_total{job="app-server", instance="0", group="production"} 0+50x10
http_requests_total{job="app-server", instance="1", group="production"} 0+60x10
http_requests_total{job="app-server", instance="0", group="canary"} 0+70x10
http_requests_total{job="app-server", instance="1", group="canary"} 0+80x10
http_requests_histogram{job="app-server", instance="1", group="production"} {{schema:1 sum:15 count:10 buckets:[3 2 5 7 9]}}x11
load 5m
@ -15,21 +15,21 @@ load 5m
vector_matching_b{l="x"} 0+4x25
eval instant at 50m SUM(http_requests) BY (job) - COUNT(http_requests) BY (job)
eval instant at 50m SUM(http_requests_total) BY (job) - COUNT(http_requests_total) BY (job)
{job="api-server"} 996
{job="app-server"} 2596
eval instant at 50m 2 - SUM(http_requests) BY (job)
eval instant at 50m 2 - SUM(http_requests_total) BY (job)
{job="api-server"} -998
{job="app-server"} -2598
eval instant at 50m -http_requests{job="api-server",instance="0",group="production"}
eval instant at 50m -http_requests_total{job="api-server",instance="0",group="production"}
{job="api-server",instance="0",group="production"} -100
eval instant at 50m +http_requests{job="api-server",instance="0",group="production"}
http_requests{job="api-server",instance="0",group="production"} 100
eval instant at 50m +http_requests_total{job="api-server",instance="0",group="production"}
http_requests_total{job="api-server",instance="0",group="production"} 100
eval instant at 50m - - - SUM(http_requests) BY (job)
eval instant at 50m - - - SUM(http_requests_total) BY (job)
{job="api-server"} -1000
{job="app-server"} -2600
@ -42,83 +42,83 @@ eval instant at 50m -2^---1*3
eval instant at 50m 2/-2^---1*3+2
-10
eval instant at 50m -10^3 * - SUM(http_requests) BY (job) ^ -1
eval instant at 50m -10^3 * - SUM(http_requests_total) BY (job) ^ -1
{job="api-server"} 1
{job="app-server"} 0.38461538461538464
eval instant at 50m 1000 / SUM(http_requests) BY (job)
eval instant at 50m 1000 / SUM(http_requests_total) BY (job)
{job="api-server"} 1
{job="app-server"} 0.38461538461538464
eval instant at 50m SUM(http_requests) BY (job) - 2
eval instant at 50m SUM(http_requests_total) BY (job) - 2
{job="api-server"} 998
{job="app-server"} 2598
eval instant at 50m SUM(http_requests) BY (job) % 3
eval instant at 50m SUM(http_requests_total) BY (job) % 3
{job="api-server"} 1
{job="app-server"} 2
eval instant at 50m SUM(http_requests) BY (job) % 0.3
eval instant at 50m SUM(http_requests_total) BY (job) % 0.3
{job="api-server"} 0.1
{job="app-server"} 0.2
eval instant at 50m SUM(http_requests) BY (job) ^ 2
eval instant at 50m SUM(http_requests_total) BY (job) ^ 2
{job="api-server"} 1000000
{job="app-server"} 6760000
eval instant at 50m SUM(http_requests) BY (job) % 3 ^ 2
eval instant at 50m SUM(http_requests_total) BY (job) % 3 ^ 2
{job="api-server"} 1
{job="app-server"} 8
eval instant at 50m SUM(http_requests) BY (job) % 2 ^ (3 ^ 2)
eval instant at 50m SUM(http_requests_total) BY (job) % 2 ^ (3 ^ 2)
{job="api-server"} 488
{job="app-server"} 40
eval instant at 50m SUM(http_requests) BY (job) % 2 ^ 3 ^ 2
eval instant at 50m SUM(http_requests_total) BY (job) % 2 ^ 3 ^ 2
{job="api-server"} 488
{job="app-server"} 40
eval instant at 50m SUM(http_requests) BY (job) % 2 ^ 3 ^ 2 ^ 2
eval instant at 50m SUM(http_requests_total) BY (job) % 2 ^ 3 ^ 2 ^ 2
{job="api-server"} 1000
{job="app-server"} 2600
eval instant at 50m COUNT(http_requests) BY (job) ^ COUNT(http_requests) BY (job)
eval instant at 50m COUNT(http_requests_total) BY (job) ^ COUNT(http_requests_total) BY (job)
{job="api-server"} 256
{job="app-server"} 256
eval instant at 50m SUM(http_requests) BY (job) / 0
eval instant at 50m SUM(http_requests_total) BY (job) / 0
{job="api-server"} +Inf
{job="app-server"} +Inf
eval instant at 50m http_requests{group="canary", instance="0", job="api-server"} / 0
eval instant at 50m http_requests_total{group="canary", instance="0", job="api-server"} / 0
{group="canary", instance="0", job="api-server"} +Inf
eval instant at 50m -1 * http_requests{group="canary", instance="0", job="api-server"} / 0
eval instant at 50m -1 * http_requests_total{group="canary", instance="0", job="api-server"} / 0
{group="canary", instance="0", job="api-server"} -Inf
eval instant at 50m 0 * http_requests{group="canary", instance="0", job="api-server"} / 0
eval instant at 50m 0 * http_requests_total{group="canary", instance="0", job="api-server"} / 0
{group="canary", instance="0", job="api-server"} NaN
eval instant at 50m 0 * http_requests{group="canary", instance="0", job="api-server"} % 0
eval instant at 50m 0 * http_requests_total{group="canary", instance="0", job="api-server"} % 0
{group="canary", instance="0", job="api-server"} NaN
eval instant at 50m SUM(http_requests) BY (job) + SUM(http_requests) BY (job)
eval instant at 50m SUM(http_requests_total) BY (job) + SUM(http_requests_total) BY (job)
{job="api-server"} 2000
{job="app-server"} 5200
eval instant at 50m (SUM((http_requests)) BY (job)) + SUM(http_requests) BY (job)
eval instant at 50m (SUM((http_requests_total)) BY (job)) + SUM(http_requests_total) BY (job)
{job="api-server"} 2000
{job="app-server"} 5200
eval instant at 50m http_requests{job="api-server", group="canary"}
http_requests{group="canary", instance="0", job="api-server"} 300
http_requests{group="canary", instance="1", job="api-server"} 400
eval instant at 50m http_requests_total{job="api-server", group="canary"}
http_requests_total{group="canary", instance="0", job="api-server"} 300
http_requests_total{group="canary", instance="1", job="api-server"} 400
eval instant at 50m http_requests{job="api-server", group="canary"} + rate(http_requests{job="api-server"}[10m]) * 5 * 60
eval instant at 50m http_requests_total{job="api-server", group="canary"} + rate(http_requests_total{job="api-server"}[10m]) * 5 * 60
{group="canary", instance="0", job="api-server"} 330
{group="canary", instance="1", job="api-server"} 440
eval instant at 50m rate(http_requests[25m]) * 25 * 60
eval instant at 50m rate(http_requests_total[25m]) * 25 * 60
{group="canary", instance="0", job="api-server"} 150
{group="canary", instance="0", job="app-server"} 350
{group="canary", instance="1", job="api-server"} 200
@ -128,7 +128,7 @@ eval instant at 50m rate(http_requests[25m]) * 25 * 60
{group="production", instance="1", job="api-server"} 100
{group="production", instance="1", job="app-server"} 300
eval instant at 50m (rate((http_requests[25m])) * 25) * 60
eval instant at 50m (rate((http_requests_total[25m])) * 25) * 60
{group="canary", instance="0", job="api-server"} 150
{group="canary", instance="0", job="app-server"} 350
{group="canary", instance="1", job="api-server"} 200
@ -139,53 +139,53 @@ eval instant at 50m (rate((http_requests[25m])) * 25) * 60
{group="production", instance="1", job="app-server"} 300
eval instant at 50m http_requests{group="canary"} and http_requests{instance="0"}
http_requests{group="canary", instance="0", job="api-server"} 300
http_requests{group="canary", instance="0", job="app-server"} 700
eval instant at 50m http_requests_total{group="canary"} and http_requests_total{instance="0"}
http_requests_total{group="canary", instance="0", job="api-server"} 300
http_requests_total{group="canary", instance="0", job="app-server"} 700
eval instant at 50m (http_requests{group="canary"} + 1) and http_requests{instance="0"}
eval instant at 50m (http_requests_total{group="canary"} + 1) and http_requests_total{instance="0"}
{group="canary", instance="0", job="api-server"} 301
{group="canary", instance="0", job="app-server"} 701
eval instant at 50m (http_requests{group="canary"} + 1) and on(instance, job) http_requests{instance="0", group="production"}
eval instant at 50m (http_requests_total{group="canary"} + 1) and on(instance, job) http_requests_total{instance="0", group="production"}
{group="canary", instance="0", job="api-server"} 301
{group="canary", instance="0", job="app-server"} 701
eval instant at 50m (http_requests{group="canary"} + 1) and on(instance) http_requests{instance="0", group="production"}
eval instant at 50m (http_requests_total{group="canary"} + 1) and on(instance) http_requests_total{instance="0", group="production"}
{group="canary", instance="0", job="api-server"} 301
{group="canary", instance="0", job="app-server"} 701
eval instant at 50m (http_requests{group="canary"} + 1) and ignoring(group) http_requests{instance="0", group="production"}
eval instant at 50m (http_requests_total{group="canary"} + 1) and ignoring(group) http_requests_total{instance="0", group="production"}
{group="canary", instance="0", job="api-server"} 301
{group="canary", instance="0", job="app-server"} 701
eval instant at 50m (http_requests{group="canary"} + 1) and ignoring(group, job) http_requests{instance="0", group="production"}
eval instant at 50m (http_requests_total{group="canary"} + 1) and ignoring(group, job) http_requests_total{instance="0", group="production"}
{group="canary", instance="0", job="api-server"} 301
{group="canary", instance="0", job="app-server"} 701
eval instant at 50m http_requests{group="canary"} or http_requests{group="production"}
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
http_requests{group="canary", instance="1", job="app-server"} 800
http_requests{group="production", instance="0", job="api-server"} 100
http_requests{group="production", instance="0", job="app-server"} 500
http_requests{group="production", instance="1", job="api-server"} 200
http_requests{group="production", instance="1", job="app-server"} 600
eval instant at 50m http_requests_total{group="canary"} or http_requests_total{group="production"}
http_requests_total{group="canary", instance="0", job="api-server"} 300
http_requests_total{group="canary", instance="0", job="app-server"} 700
http_requests_total{group="canary", instance="1", job="api-server"} 400
http_requests_total{group="canary", instance="1", job="app-server"} 800
http_requests_total{group="production", instance="0", job="api-server"} 100
http_requests_total{group="production", instance="0", job="app-server"} 500
http_requests_total{group="production", instance="1", job="api-server"} 200
http_requests_total{group="production", instance="1", job="app-server"} 600
# On overlap the rhs samples must be dropped.
eval instant at 50m (http_requests{group="canary"} + 1) or http_requests{instance="1"}
eval instant at 50m (http_requests_total{group="canary"} + 1) or http_requests_total{instance="1"}
{group="canary", instance="0", job="api-server"} 301
{group="canary", instance="0", job="app-server"} 701
{group="canary", instance="1", job="api-server"} 401
{group="canary", instance="1", job="app-server"} 801
http_requests{group="production", instance="1", job="api-server"} 200
http_requests{group="production", instance="1", job="app-server"} 600
http_requests_total{group="production", instance="1", job="api-server"} 200
http_requests_total{group="production", instance="1", job="app-server"} 600
# Matching only on instance excludes everything that has instance=0/1 but includes
# entries without the instance label.
eval instant at 50m (http_requests{group="canary"} + 1) or on(instance) (http_requests or cpu_count or vector_matching_a)
eval instant at 50m (http_requests_total{group="canary"} + 1) or on(instance) (http_requests_total or cpu_count or vector_matching_a)
{group="canary", instance="0", job="api-server"} 301
{group="canary", instance="0", job="app-server"} 701
{group="canary", instance="1", job="api-server"} 401
@ -193,7 +193,7 @@ eval instant at 50m (http_requests{group="canary"} + 1) or on(instance) (http_re
vector_matching_a{l="x"} 10
vector_matching_a{l="y"} 20
eval instant at 50m (http_requests{group="canary"} + 1) or ignoring(l, group, job) (http_requests or cpu_count or vector_matching_a)
eval instant at 50m (http_requests_total{group="canary"} + 1) or ignoring(l, group, job) (http_requests_total or cpu_count or vector_matching_a)
{group="canary", instance="0", job="api-server"} 301
{group="canary", instance="0", job="app-server"} 701
{group="canary", instance="1", job="api-server"} 401
@ -201,81 +201,81 @@ eval instant at 50m (http_requests{group="canary"} + 1) or ignoring(l, group, jo
vector_matching_a{l="x"} 10
vector_matching_a{l="y"} 20
eval instant at 50m http_requests{group="canary"} unless http_requests{instance="0"}
http_requests{group="canary", instance="1", job="api-server"} 400
http_requests{group="canary", instance="1", job="app-server"} 800
eval instant at 50m http_requests_total{group="canary"} unless http_requests_total{instance="0"}
http_requests_total{group="canary", instance="1", job="api-server"} 400
http_requests_total{group="canary", instance="1", job="app-server"} 800
eval instant at 50m http_requests{group="canary"} unless on(job) http_requests{instance="0"}
eval instant at 50m http_requests_total{group="canary"} unless on(job) http_requests_total{instance="0"}
eval instant at 50m http_requests{group="canary"} unless on(job, instance) http_requests{instance="0"}
http_requests{group="canary", instance="1", job="api-server"} 400
http_requests{group="canary", instance="1", job="app-server"} 800
eval instant at 50m http_requests_total{group="canary"} unless on(job, instance) http_requests_total{instance="0"}
http_requests_total{group="canary", instance="1", job="api-server"} 400
http_requests_total{group="canary", instance="1", job="app-server"} 800
eval instant at 50m http_requests{group="canary"} / on(instance,job) http_requests{group="production"}
eval instant at 50m http_requests_total{group="canary"} / on(instance,job) http_requests_total{group="production"}
{instance="0", job="api-server"} 3
{instance="0", job="app-server"} 1.4
{instance="1", job="api-server"} 2
{instance="1", job="app-server"} 1.3333333333333333
eval instant at 50m http_requests{group="canary"} unless ignoring(group, instance) http_requests{instance="0"}
eval instant at 50m http_requests_total{group="canary"} unless ignoring(group, instance) http_requests_total{instance="0"}
eval instant at 50m http_requests{group="canary"} unless ignoring(group) http_requests{instance="0"}
http_requests{group="canary", instance="1", job="api-server"} 400
http_requests{group="canary", instance="1", job="app-server"} 800
eval instant at 50m http_requests_total{group="canary"} unless ignoring(group) http_requests_total{instance="0"}
http_requests_total{group="canary", instance="1", job="api-server"} 400
http_requests_total{group="canary", instance="1", job="app-server"} 800
eval instant at 50m http_requests{group="canary"} / ignoring(group) http_requests{group="production"}
eval instant at 50m http_requests_total{group="canary"} / ignoring(group) http_requests_total{group="production"}
{instance="0", job="api-server"} 3
{instance="0", job="app-server"} 1.4
{instance="1", job="api-server"} 2
{instance="1", job="app-server"} 1.3333333333333333
# https://github.com/prometheus/prometheus/issues/1489
eval instant at 50m http_requests AND ON (dummy) vector(1)
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
http_requests{group="canary", instance="1", job="app-server"} 800
http_requests{group="production", instance="0", job="api-server"} 100
http_requests{group="production", instance="0", job="app-server"} 500
http_requests{group="production", instance="1", job="api-server"} 200
http_requests{group="production", instance="1", job="app-server"} 600
eval instant at 50m http_requests AND IGNORING (group, instance, job) vector(1)
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
http_requests{group="canary", instance="1", job="app-server"} 800
http_requests{group="production", instance="0", job="api-server"} 100
http_requests{group="production", instance="0", job="app-server"} 500
http_requests{group="production", instance="1", job="api-server"} 200
http_requests{group="production", instance="1", job="app-server"} 600
eval instant at 50m http_requests_total AND ON (dummy) vector(1)
http_requests_total{group="canary", instance="0", job="api-server"} 300
http_requests_total{group="canary", instance="0", job="app-server"} 700
http_requests_total{group="canary", instance="1", job="api-server"} 400
http_requests_total{group="canary", instance="1", job="app-server"} 800
http_requests_total{group="production", instance="0", job="api-server"} 100
http_requests_total{group="production", instance="0", job="app-server"} 500
http_requests_total{group="production", instance="1", job="api-server"} 200
http_requests_total{group="production", instance="1", job="app-server"} 600
eval instant at 50m http_requests_total AND IGNORING (group, instance, job) vector(1)
http_requests_total{group="canary", instance="0", job="api-server"} 300
http_requests_total{group="canary", instance="0", job="app-server"} 700
http_requests_total{group="canary", instance="1", job="api-server"} 400
http_requests_total{group="canary", instance="1", job="app-server"} 800
http_requests_total{group="production", instance="0", job="api-server"} 100
http_requests_total{group="production", instance="0", job="app-server"} 500
http_requests_total{group="production", instance="1", job="api-server"} 200
http_requests_total{group="production", instance="1", job="app-server"} 600
# Comparisons.
eval instant at 50m SUM(http_requests) BY (job) > 1000
eval instant at 50m SUM(http_requests_total) BY (job) > 1000
{job="app-server"} 2600
eval instant at 50m 1000 < SUM(http_requests) BY (job)
eval instant at 50m 1000 < SUM(http_requests_total) BY (job)
{job="app-server"} 2600
eval instant at 50m SUM(http_requests) BY (job) <= 1000
eval instant at 50m SUM(http_requests_total) BY (job) <= 1000
{job="api-server"} 1000
eval instant at 50m SUM(http_requests) BY (job) != 1000
eval instant at 50m SUM(http_requests_total) BY (job) != 1000
{job="app-server"} 2600
eval instant at 50m SUM(http_requests) BY (job) == 1000
eval instant at 50m SUM(http_requests_total) BY (job) == 1000
{job="api-server"} 1000
eval instant at 50m SUM(http_requests) BY (job) == bool 1000
eval instant at 50m SUM(http_requests_total) BY (job) == bool 1000
{job="api-server"} 1
{job="app-server"} 0
eval instant at 50m SUM(http_requests) BY (job) == bool SUM(http_requests) BY (job)
eval instant at 50m SUM(http_requests_total) BY (job) == bool SUM(http_requests_total) BY (job)
{job="api-server"} 1
{job="app-server"} 1
eval instant at 50m SUM(http_requests) BY (job) != bool SUM(http_requests) BY (job)
eval instant at 50m SUM(http_requests_total) BY (job) != bool SUM(http_requests_total) BY (job)
{job="api-server"} 0
{job="app-server"} 0
@ -285,12 +285,12 @@ eval instant at 50m 0 == bool 1
eval instant at 50m 1 == bool 1
1
eval instant at 50m http_requests{job="api-server", instance="0", group="production"} == bool 100
eval instant at 50m http_requests_total{job="api-server", instance="0", group="production"} == bool 100
{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
http_requests{group="canary", instance="1", job="app-server"} 80
http_requests_total{group="canary", instance="1", job="app-server"} 80
eval_info instant at 5m http_requests_histogram != 80
@ -673,7 +673,7 @@ eval_info range from 0 to 24m step 6m left_histograms == 0
eval_info range from 0 to 24m step 6m left_histograms != 3
# No results.
eval range from 0 to 24m step 6m left_histograms != 0
eval_info range from 0 to 24m step 6m left_histograms != 0
# No results.
eval_info range from 0 to 24m step 6m left_histograms > 3
@ -682,7 +682,7 @@ eval_info range from 0 to 24m step 6m left_histograms > 3
eval_info range from 0 to 24m step 6m left_histograms > 0
# No results.
eval range from 0 to 24m step 6m left_histograms >= 3
eval_info range from 0 to 24m step 6m left_histograms >= 3
# No results.
eval_info range from 0 to 24m step 6m left_histograms >= 0
@ -697,7 +697,7 @@ eval_info range from 0 to 24m step 6m left_histograms < 0
eval_info range from 0 to 24m step 6m left_histograms <= 3
# No results.
eval range from 0 to 24m step 6m left_histograms <= 0
eval_info range from 0 to 24m step 6m left_histograms <= 0
# No results.
eval_info range from 0 to 24m step 6m left_histograms == bool 3
@ -770,40 +770,40 @@ 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 range from 0 to 24m step 6m 3 == left_histograms
eval_info range from 0 to 24m step 6m 3 == left_histograms
# No results.
eval range from 0 to 24m step 6m 0 == left_histograms
eval_info range from 0 to 24m step 6m 0 == left_histograms
# No results.
eval range from 0 to 24m step 6m 3 != left_histograms
eval_info range from 0 to 24m step 6m 3 != left_histograms
# No results.
eval range from 0 to 24m step 6m 0 != left_histograms
eval_info range from 0 to 24m step 6m 0 != left_histograms
# No results.
eval range from 0 to 24m step 6m 3 < left_histograms
eval_info range from 0 to 24m step 6m 3 < left_histograms
# No results.
eval range from 0 to 24m step 6m 0 < left_histograms
eval_info range from 0 to 24m step 6m 0 < left_histograms
# No results.
eval range from 0 to 24m step 6m 3 < left_histograms
eval_info range from 0 to 24m step 6m 3 < left_histograms
# No results.
eval range from 0 to 24m step 6m 0 < left_histograms
eval_info range from 0 to 24m step 6m 0 < left_histograms
# No results.
eval range from 0 to 24m step 6m 3 > left_histograms
eval_info range from 0 to 24m step 6m 3 > left_histograms
# No results.
eval range from 0 to 24m step 6m 0 > left_histograms
eval_info range from 0 to 24m step 6m 0 > left_histograms
# No results.
eval range from 0 to 24m step 6m 3 >= left_histograms
eval_info range from 0 to 24m step 6m 3 >= left_histograms
# No results.
eval range from 0 to 24m step 6m 0 >= left_histograms
eval_info range from 0 to 24m step 6m 0 >= left_histograms
# No results.
clear

172
promql/promqltest/testdata/selectors.test vendored

@ -1,109 +1,109 @@
load 10s
http_requests{job="api-server", instance="0", group="production"} 0+10x1000 100+30x1000
http_requests{job="api-server", instance="1", group="production"} 0+20x1000 200+30x1000
http_requests{job="api-server", instance="0", group="canary"} 0+30x1000 300+80x1000
http_requests{job="api-server", instance="1", group="canary"} 0+40x2000
http_requests_total{job="api-server", instance="0", group="production"} 0+10x1000 100+30x1000
http_requests_total{job="api-server", instance="1", group="production"} 0+20x1000 200+30x1000
http_requests_total{job="api-server", instance="0", group="canary"} 0+30x1000 300+80x1000
http_requests_total{job="api-server", instance="1", group="canary"} 0+40x2000
eval instant at 8000s rate(http_requests[1m])
eval instant at 8000s rate(http_requests_total[1m])
{job="api-server", instance="0", group="production"} 1
{job="api-server", instance="1", group="production"} 2
{job="api-server", instance="0", group="canary"} 3
{job="api-server", instance="1", group="canary"} 4
eval instant at 18000s rate(http_requests[1m])
eval instant at 18000s rate(http_requests_total[1m])
{job="api-server", instance="0", group="production"} 3
{job="api-server", instance="1", group="production"} 3
{job="api-server", instance="0", group="canary"} 8
{job="api-server", instance="1", group="canary"} 4
eval instant at 8000s rate(http_requests{group=~"pro.*"}[1m])
eval instant at 8000s rate(http_requests_total{group=~"pro.*"}[1m])
{job="api-server", instance="0", group="production"} 1
{job="api-server", instance="1", group="production"} 2
eval instant at 18000s rate(http_requests{group=~".*ry", instance="1"}[1m])
eval instant at 18000s rate(http_requests_total{group=~".*ry", instance="1"}[1m])
{job="api-server", instance="1", group="canary"} 4
eval instant at 18000s rate(http_requests{instance!="3"}[1m] offset 10000s)
eval instant at 18000s rate(http_requests_total{instance!="3"}[1m] offset 10000s)
{job="api-server", instance="0", group="production"} 1
{job="api-server", instance="1", group="production"} 2
{job="api-server", instance="0", group="canary"} 3
{job="api-server", instance="1", group="canary"} 4
eval instant at 4000s rate(http_requests{instance!="3"}[1m] offset -4000s)
eval instant at 4000s rate(http_requests_total{instance!="3"}[1m] offset -4000s)
{job="api-server", instance="0", group="production"} 1
{job="api-server", instance="1", group="production"} 2
{job="api-server", instance="0", group="canary"} 3
{job="api-server", instance="1", group="canary"} 4
eval instant at 18000s rate(http_requests[40s]) - rate(http_requests[1m] offset 10000s)
eval instant at 18000s rate(http_requests_total[40s]) - rate(http_requests_total[1m] offset 10000s)
{job="api-server", instance="0", group="production"} 2
{job="api-server", instance="1", group="production"} 1
{job="api-server", instance="0", group="canary"} 5
{job="api-server", instance="1", group="canary"} 0
# https://github.com/prometheus/prometheus/issues/3575
eval instant at 0s http_requests{foo!="bar"}
http_requests{job="api-server", instance="0", group="production"} 0
http_requests{job="api-server", instance="1", group="production"} 0
http_requests{job="api-server", instance="0", group="canary"} 0
http_requests{job="api-server", instance="1", group="canary"} 0
eval instant at 0s http_requests{foo!="bar", job="api-server"}
http_requests{job="api-server", instance="0", group="production"} 0
http_requests{job="api-server", instance="1", group="production"} 0
http_requests{job="api-server", instance="0", group="canary"} 0
http_requests{job="api-server", instance="1", group="canary"} 0
eval instant at 0s http_requests{foo!~"bar", job="api-server"}
http_requests{job="api-server", instance="0", group="production"} 0
http_requests{job="api-server", instance="1", group="production"} 0
http_requests{job="api-server", instance="0", group="canary"} 0
http_requests{job="api-server", instance="1", group="canary"} 0
eval instant at 0s http_requests{foo!~"bar", job="api-server", instance="1", x!="y", z="", group!=""}
http_requests{job="api-server", instance="1", group="production"} 0
http_requests{job="api-server", instance="1", group="canary"} 0
eval instant at 0s http_requests_total{foo!="bar"}
http_requests_total{job="api-server", instance="0", group="production"} 0
http_requests_total{job="api-server", instance="1", group="production"} 0
http_requests_total{job="api-server", instance="0", group="canary"} 0
http_requests_total{job="api-server", instance="1", group="canary"} 0
eval instant at 0s http_requests_total{foo!="bar", job="api-server"}
http_requests_total{job="api-server", instance="0", group="production"} 0
http_requests_total{job="api-server", instance="1", group="production"} 0
http_requests_total{job="api-server", instance="0", group="canary"} 0
http_requests_total{job="api-server", instance="1", group="canary"} 0
eval instant at 0s http_requests_total{foo!~"bar", job="api-server"}
http_requests_total{job="api-server", instance="0", group="production"} 0
http_requests_total{job="api-server", instance="1", group="production"} 0
http_requests_total{job="api-server", instance="0", group="canary"} 0
http_requests_total{job="api-server", instance="1", group="canary"} 0
eval instant at 0s http_requests_total{foo!~"bar", job="api-server", instance="1", x!="y", z="", group!=""}
http_requests_total{job="api-server", instance="1", group="production"} 0
http_requests_total{job="api-server", instance="1", group="canary"} 0
# https://github.com/prometheus/prometheus/issues/7994
eval instant at 8000s rate(http_requests{group=~"(?i:PRO).*"}[1m])
eval instant at 8000s rate(http_requests_total{group=~"(?i:PRO).*"}[1m])
{job="api-server", instance="0", group="production"} 1
{job="api-server", instance="1", group="production"} 2
eval instant at 8000s rate(http_requests{group=~".*?(?i:PRO).*"}[1m])
eval instant at 8000s rate(http_requests_total{group=~".*?(?i:PRO).*"}[1m])
{job="api-server", instance="0", group="production"} 1
{job="api-server", instance="1", group="production"} 2
eval instant at 8000s rate(http_requests{group=~".*(?i:DUC).*"}[1m])
eval instant at 8000s rate(http_requests_total{group=~".*(?i:DUC).*"}[1m])
{job="api-server", instance="0", group="production"} 1
{job="api-server", instance="1", group="production"} 2
eval instant at 8000s rate(http_requests{group=~".*(?i:TION)"}[1m])
eval instant at 8000s rate(http_requests_total{group=~".*(?i:TION)"}[1m])
{job="api-server", instance="0", group="production"} 1
{job="api-server", instance="1", group="production"} 2
eval instant at 8000s rate(http_requests{group=~".*(?i:TION).*?"}[1m])
eval instant at 8000s rate(http_requests_total{group=~".*(?i:TION).*?"}[1m])
{job="api-server", instance="0", group="production"} 1
{job="api-server", instance="1", group="production"} 2
eval instant at 8000s rate(http_requests{group=~"((?i)PRO).*"}[1m])
eval instant at 8000s rate(http_requests_total{group=~"((?i)PRO).*"}[1m])
{job="api-server", instance="0", group="production"} 1
{job="api-server", instance="1", group="production"} 2
eval instant at 8000s rate(http_requests{group=~".*((?i)DUC).*"}[1m])
eval instant at 8000s rate(http_requests_total{group=~".*((?i)DUC).*"}[1m])
{job="api-server", instance="0", group="production"} 1
{job="api-server", instance="1", group="production"} 2
eval instant at 8000s rate(http_requests{group=~".*((?i)TION)"}[1m])
eval instant at 8000s rate(http_requests_total{group=~".*((?i)TION)"}[1m])
{job="api-server", instance="0", group="production"} 1
{job="api-server", instance="1", group="production"} 2
eval instant at 8000s rate(http_requests{group=~"(?i:PRODUCTION)"}[1m])
eval instant at 8000s rate(http_requests_total{group=~"(?i:PRODUCTION)"}[1m])
{job="api-server", instance="0", group="production"} 1
{job="api-server", instance="1", group="production"} 2
eval instant at 8000s rate(http_requests{group=~".*(?i:C).*"}[1m])
eval instant at 8000s rate(http_requests_total{group=~".*(?i:C).*"}[1m])
{job="api-server", instance="0", group="production"} 1
{job="api-server", instance="1", group="production"} 2
{job="api-server", instance="0", group="canary"} 3
@ -133,14 +133,14 @@ load 5m
label_grouping_test{a="a", b="abb"} 0+20x10
load 5m
http_requests{job="api-server", instance="0", group="production"} 0+10x10
http_requests{job="api-server", instance="1", group="production"} 0+20x10
http_requests{job="api-server", instance="0", group="canary"} 0+30x10
http_requests{job="api-server", instance="1", group="canary"} 0+40x10
http_requests{job="app-server", instance="0", group="production"} 0+50x10
http_requests{job="app-server", instance="1", group="production"} 0+60x10
http_requests{job="app-server", instance="0", group="canary"} 0+70x10
http_requests{job="app-server", instance="1", group="canary"} 0+80x10
http_requests_total{job="api-server", instance="0", group="production"} 0+10x10
http_requests_total{job="api-server", instance="1", group="production"} 0+20x10
http_requests_total{job="api-server", instance="0", group="canary"} 0+30x10
http_requests_total{job="api-server", instance="1", group="canary"} 0+40x10
http_requests_total{job="app-server", instance="0", group="production"} 0+50x10
http_requests_total{job="app-server", instance="1", group="production"} 0+60x10
http_requests_total{job="app-server", instance="0", group="canary"} 0+70x10
http_requests_total{job="app-server", instance="1", group="canary"} 0+80x10
# Single-letter label names and values.
eval instant at 50m x{y="testvalue"}
@ -148,14 +148,14 @@ eval instant at 50m x{y="testvalue"}
# Basic Regex
eval instant at 50m {__name__=~".+"}
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
http_requests{group="canary", instance="1", job="app-server"} 800
http_requests{group="production", instance="0", job="api-server"} 100
http_requests{group="production", instance="0", job="app-server"} 500
http_requests{group="production", instance="1", job="api-server"} 200
http_requests{group="production", instance="1", job="app-server"} 600
http_requests_total{group="canary", instance="0", job="api-server"} 300
http_requests_total{group="canary", instance="0", job="app-server"} 700
http_requests_total{group="canary", instance="1", job="api-server"} 400
http_requests_total{group="canary", instance="1", job="app-server"} 800
http_requests_total{group="production", instance="0", job="api-server"} 100
http_requests_total{group="production", instance="0", job="app-server"} 500
http_requests_total{group="production", instance="1", job="api-server"} 200
http_requests_total{group="production", instance="1", job="app-server"} 600
x{y="testvalue"} 100
label_grouping_test{a="a", b="abb"} 200
label_grouping_test{a="aa", b="bb"} 100
@ -164,34 +164,34 @@ eval instant at 50m {__name__=~".+"}
cpu_count{instance="0", type="numa"} 300
eval instant at 50m {job=~".+-server", job!~"api-.+"}
http_requests{group="canary", instance="0", job="app-server"} 700
http_requests{group="canary", instance="1", job="app-server"} 800
http_requests{group="production", instance="0", job="app-server"} 500
http_requests{group="production", instance="1", job="app-server"} 600
eval instant at 50m http_requests{group!="canary"}
http_requests{group="production", instance="1", job="app-server"} 600
http_requests{group="production", instance="0", job="app-server"} 500
http_requests{group="production", instance="1", job="api-server"} 200
http_requests{group="production", instance="0", job="api-server"} 100
eval instant at 50m http_requests{job=~".+-server",group!="canary"}
http_requests{group="production", instance="1", job="app-server"} 600
http_requests{group="production", instance="0", job="app-server"} 500
http_requests{group="production", instance="1", job="api-server"} 200
http_requests{group="production", instance="0", job="api-server"} 100
eval instant at 50m http_requests{job!~"api-.+",group!="canary"}
http_requests{group="production", instance="1", job="app-server"} 600
http_requests{group="production", instance="0", job="app-server"} 500
eval instant at 50m http_requests{group="production",job=~"api-.+"}
http_requests{group="production", instance="0", job="api-server"} 100
http_requests{group="production", instance="1", job="api-server"} 200
eval instant at 50m http_requests{group="production",job="api-server"} offset 5m
http_requests{group="production", instance="0", job="api-server"} 90
http_requests{group="production", instance="1", job="api-server"} 180
http_requests_total{group="canary", instance="0", job="app-server"} 700
http_requests_total{group="canary", instance="1", job="app-server"} 800
http_requests_total{group="production", instance="0", job="app-server"} 500
http_requests_total{group="production", instance="1", job="app-server"} 600
eval instant at 50m http_requests_total{group!="canary"}
http_requests_total{group="production", instance="1", job="app-server"} 600
http_requests_total{group="production", instance="0", job="app-server"} 500
http_requests_total{group="production", instance="1", job="api-server"} 200
http_requests_total{group="production", instance="0", job="api-server"} 100
eval instant at 50m http_requests_total{job=~".+-server",group!="canary"}
http_requests_total{group="production", instance="1", job="app-server"} 600
http_requests_total{group="production", instance="0", job="app-server"} 500
http_requests_total{group="production", instance="1", job="api-server"} 200
http_requests_total{group="production", instance="0", job="api-server"} 100
eval instant at 50m http_requests_total{job!~"api-.+",group!="canary"}
http_requests_total{group="production", instance="1", job="app-server"} 600
http_requests_total{group="production", instance="0", job="app-server"} 500
eval instant at 50m http_requests_total{group="production",job=~"api-.+"}
http_requests_total{group="production", instance="0", job="api-server"} 100
http_requests_total{group="production", instance="1", job="api-server"} 200
eval instant at 50m http_requests_total{group="production",job="api-server"} offset 5m
http_requests_total{group="production", instance="0", job="api-server"} 90
http_requests_total{group="production", instance="1", job="api-server"} 180
clear

84
promql/promqltest/testdata/subquery.test vendored

@ -1,41 +1,41 @@
load 10s
metric 1 2
metric_total 1 2
# Evaluation before 0s gets no sample.
eval instant at 10s sum_over_time(metric[50s:10s])
eval instant at 10s sum_over_time(metric_total[50s:10s])
{} 3
eval instant at 10s sum_over_time(metric[50s:5s])
eval instant at 10s sum_over_time(metric_total[50s:5s])
{} 4
# Every evaluation yields the last value, i.e. 2
eval instant at 5m sum_over_time(metric[50s:10s])
eval instant at 5m sum_over_time(metric_total[50s:10s])
{} 10
# Series becomes stale at 5m10s (5m after last sample)
# Series becomes stale at 5m10s (5m after last sample).
# Hence subquery gets a single sample at 5m10s.
eval instant at 5m59s sum_over_time(metric[60s:10s])
eval instant at 5m59s sum_over_time(metric_total[60s:10s])
{} 2
eval instant at 10s rate(metric[20s:10s])
eval instant at 10s rate(metric_total[20s:10s])
{} 0.1
eval instant at 20s rate(metric[20s:5s])
eval instant at 20s rate(metric_total[20s:5s])
{} 0.06666666666666667
clear
load 10s
http_requests{job="api-server", instance="1", group="production"} 0+20x1000 200+30x1000
http_requests{job="api-server", instance="0", group="production"} 0+10x1000 100+30x1000
http_requests{job="api-server", instance="0", group="canary"} 0+30x1000 300+80x1000
http_requests{job="api-server", instance="1", group="canary"} 0+40x2000
http_requests_total{job="api-server", instance="1", group="production"} 0+20x1000 200+30x1000
http_requests_total{job="api-server", instance="0", group="production"} 0+10x1000 100+30x1000
http_requests_total{job="api-server", instance="0", group="canary"} 0+30x1000 300+80x1000
http_requests_total{job="api-server", instance="1", group="canary"} 0+40x2000
eval instant at 8000s rate(http_requests{group=~"pro.*"}[1m:10s])
eval instant at 8000s rate(http_requests_total{group=~"pro.*"}[1m:10s])
{job="api-server", instance="0", group="production"} 1
{job="api-server", instance="1", group="production"} 2
eval instant at 20000s avg_over_time(rate(http_requests[1m])[1m:1s])
eval instant at 20000s avg_over_time(rate(http_requests_total[1m])[1m:1s])
{job="api-server", instance="0", group="canary"} 8
{job="api-server", instance="1", group="canary"} 4
{job="api-server", instance="1", group="production"} 3
@ -44,64 +44,64 @@ eval instant at 20000s avg_over_time(rate(http_requests[1m])[1m:1s])
clear
load 10s
metric1 0+1x1000
metric2 0+2x1000
metric3 0+3x1000
metric1_total 0+1x1000
metric2_total 0+2x1000
metric3_total 0+3x1000
eval instant at 1000s sum_over_time(metric1[30s:10s])
eval instant at 1000s sum_over_time(metric1_total[30s:10s])
{} 297
# This is (97 + 98*2 + 99*2 + 100), because other than 97@975s and 100@1000s,
# everything else is repeated with the 5s step.
eval instant at 1000s sum_over_time(metric1[30s:5s])
eval instant at 1000s sum_over_time(metric1_total[30s:5s])
{} 591
# Offset is aligned with the step, so this is from [98@980s, 99@990s, 100@1000s].
eval instant at 1010s sum_over_time(metric1[30s:10s] offset 10s)
eval instant at 1010s sum_over_time(metric1_total[30s:10s] offset 10s)
{} 297
# Same result for different offsets due to step alignment.
eval instant at 1010s sum_over_time(metric1[30s:10s] offset 9s)
eval instant at 1010s sum_over_time(metric1_total[30s:10s] offset 9s)
{} 297
eval instant at 1010s sum_over_time(metric1[30s:10s] offset 7s)
eval instant at 1010s sum_over_time(metric1_total[30s:10s] offset 7s)
{} 297
eval instant at 1010s sum_over_time(metric1[30s:10s] offset 5s)
eval instant at 1010s sum_over_time(metric1_total[30s:10s] offset 5s)
{} 297
eval instant at 1010s sum_over_time(metric1[30s:10s] offset 3s)
eval instant at 1010s sum_over_time(metric1_total[30s:10s] offset 3s)
{} 297
eval instant at 1010s sum_over_time((metric1)[30s:10s] offset 3s)
eval instant at 1010s sum_over_time((metric1_total)[30s:10s] offset 3s)
{} 297
eval instant at 1010s sum_over_time(metric1[30:10] offset 3)
eval instant at 1010s sum_over_time(metric1_total[30:10] offset 3)
{} 297
eval instant at 1010s sum_over_time((metric1)[30:10s] offset 3s)
eval instant at 1010s sum_over_time((metric1_total)[30:10s] offset 3s)
{} 297
eval instant at 1010s sum_over_time((metric1)[30:10s] offset 3s)
eval instant at 1010s sum_over_time((metric1_total)[30:10s] offset 3s)
{} 297
eval instant at 1010s sum_over_time((metric1)[30:10] offset 3s)
eval instant at 1010s sum_over_time((metric1_total)[30:10] offset 3s)
{} 297
eval instant at 1010s sum_over_time((metric1)[30:10] offset 3)
eval instant at 1010s sum_over_time((metric1_total)[30:10] offset 3)
{} 297
# Nested subqueries
eval instant at 1000s rate(sum_over_time(metric1[30s:10s])[50s:10s])
# Nested subqueries.
eval instant at 1000s rate(sum_over_time(metric1_total[30s:10s])[50s:10s])
{} 0.30000000000000004
eval instant at 1000s rate(sum_over_time(metric2[30s:10s])[50s:10s])
eval instant at 1000s rate(sum_over_time(metric2_total[30s:10s])[50s:10s])
{} 0.6000000000000001
eval instant at 1000s rate(sum_over_time(metric3[30s:10s])[50s:10s])
eval instant at 1000s rate(sum_over_time(metric3_total[30s:10s])[50s:10s])
{} 0.9
eval instant at 1000s rate(sum_over_time((metric1+metric2+metric3)[30s:10s])[30s:10s])
eval instant at 1000s rate(sum_over_time((metric1_total+metric2_total+metric3_total)[30s:10s])[30s:10s])
{} 1.8
clear
@ -109,28 +109,28 @@ clear
# Fibonacci sequence, to ensure the rate is not constant.
# Additional note: using subqueries unnecessarily is unwise.
load 7s
metric 1 1 2 3 5 8 13 21 34 55 89 144 233 377 610 987 1597 2584 4181 6765 10946 17711 28657 46368 75025 121393 196418 317811 514229 832040 1346269 2178309 3524578 5702887 9227465 14930352 24157817 39088169 63245986 102334155 165580141 267914296 433494437 701408733 1134903170 1836311903 2971215073 4807526976 7778742049 12586269025 20365011074 32951280099 53316291173 86267571272 139583862445 225851433717 365435296162 591286729879 956722026041 1548008755920 2504730781961 4052739537881 6557470319842 10610209857723 17167680177565 27777890035288 44945570212853 72723460248141 117669030460994 190392490709135 308061521170129 498454011879264 806515533049393 1304969544928657 2111485077978050 3416454622906707 5527939700884757 8944394323791464 14472334024676221 23416728348467685 37889062373143906 61305790721611591 99194853094755497 160500643816367088 259695496911122585 420196140727489673 679891637638612258 1100087778366101931 1779979416004714189 2880067194370816120 4660046610375530309 7540113804746346429 12200160415121876738 19740274219868223167 31940434634990099905 51680708854858323072 83621143489848422977 135301852344706746049 218922995834555169026 354224848179261915075 573147844013817084101 927372692193078999176 1500520536206896083277 2427893228399975082453 3928413764606871165730 6356306993006846248183 10284720757613717413913 16641027750620563662096 26925748508234281076009 43566776258854844738105 70492524767089125814114 114059301025943970552219 184551825793033096366333 298611126818977066918552 483162952612010163284885 781774079430987230203437 1264937032042997393488322 2046711111473984623691759 3311648143516982017180081 5358359254990966640871840 8670007398507948658051921 14028366653498915298923761 22698374052006863956975682 36726740705505779255899443 59425114757512643212875125 96151855463018422468774568 155576970220531065681649693 251728825683549488150424261 407305795904080553832073954 659034621587630041982498215 1066340417491710595814572169 1725375039079340637797070384 2791715456571051233611642553 4517090495650391871408712937 7308805952221443105020355490 11825896447871834976429068427 19134702400093278081449423917 30960598847965113057878492344 50095301248058391139327916261 81055900096023504197206408605 131151201344081895336534324866 212207101440105399533740733471 343358302784187294870275058337 555565404224292694404015791808 898923707008479989274290850145 1454489111232772683678306641953 2353412818241252672952597492098 3807901929474025356630904134051 6161314747715278029583501626149 9969216677189303386214405760200 16130531424904581415797907386349 26099748102093884802012313146549 42230279526998466217810220532898 68330027629092351019822533679447 110560307156090817237632754212345 178890334785183168257455287891792 289450641941273985495088042104137 468340976726457153752543329995929 757791618667731139247631372100066 1226132595394188293000174702095995 1983924214061919432247806074196061 3210056809456107725247980776292056 5193981023518027157495786850488117 8404037832974134882743767626780173 13598018856492162040239554477268290 22002056689466296922983322104048463 35600075545958458963222876581316753 57602132235424755886206198685365216 93202207781383214849429075266681969 150804340016807970735635273952047185 244006547798191185585064349218729154 394810887814999156320699623170776339 638817435613190341905763972389505493 1033628323428189498226463595560281832 1672445759041379840132227567949787325 2706074082469569338358691163510069157 4378519841510949178490918731459856482 7084593923980518516849609894969925639 11463113765491467695340528626429782121 18547707689471986212190138521399707760
metric_total 1 1 2 3 5 8 13 21 34 55 89 144 233 377 610 987 1597 2584 4181 6765 10946 17711 28657 46368 75025 121393 196418 317811 514229 832040 1346269 2178309 3524578 5702887 9227465 14930352 24157817 39088169 63245986 102334155 165580141 267914296 433494437 701408733 1134903170 1836311903 2971215073 4807526976 7778742049 12586269025 20365011074 32951280099 53316291173 86267571272 139583862445 225851433717 365435296162 591286729879 956722026041 1548008755920 2504730781961 4052739537881 6557470319842 10610209857723 17167680177565 27777890035288 44945570212853 72723460248141 117669030460994 190392490709135 308061521170129 498454011879264 806515533049393 1304969544928657 2111485077978050 3416454622906707 5527939700884757 8944394323791464 14472334024676221 23416728348467685 37889062373143906 61305790721611591 99194853094755497 160500643816367088 259695496911122585 420196140727489673 679891637638612258 1100087778366101931 1779979416004714189 2880067194370816120 4660046610375530309 7540113804746346429 12200160415121876738 19740274219868223167 31940434634990099905 51680708854858323072 83621143489848422977 135301852344706746049 218922995834555169026 354224848179261915075 573147844013817084101 927372692193078999176 1500520536206896083277 2427893228399975082453 3928413764606871165730 6356306993006846248183 10284720757613717413913 16641027750620563662096 26925748508234281076009 43566776258854844738105 70492524767089125814114 114059301025943970552219 184551825793033096366333 298611126818977066918552 483162952612010163284885 781774079430987230203437 1264937032042997393488322 2046711111473984623691759 3311648143516982017180081 5358359254990966640871840 8670007398507948658051921 14028366653498915298923761 22698374052006863956975682 36726740705505779255899443 59425114757512643212875125 96151855463018422468774568 155576970220531065681649693 251728825683549488150424261 407305795904080553832073954 659034621587630041982498215 1066340417491710595814572169 1725375039079340637797070384 2791715456571051233611642553 4517090495650391871408712937 7308805952221443105020355490 11825896447871834976429068427 19134702400093278081449423917 30960598847965113057878492344 50095301248058391139327916261 81055900096023504197206408605 131151201344081895336534324866 212207101440105399533740733471 343358302784187294870275058337 555565404224292694404015791808 898923707008479989274290850145 1454489111232772683678306641953 2353412818241252672952597492098 3807901929474025356630904134051 6161314747715278029583501626149 9969216677189303386214405760200 16130531424904581415797907386349 26099748102093884802012313146549 42230279526998466217810220532898 68330027629092351019822533679447 110560307156090817237632754212345 178890334785183168257455287891792 289450641941273985495088042104137 468340976726457153752543329995929 757791618667731139247631372100066 1226132595394188293000174702095995 1983924214061919432247806074196061 3210056809456107725247980776292056 5193981023518027157495786850488117 8404037832974134882743767626780173 13598018856492162040239554477268290 22002056689466296922983322104048463 35600075545958458963222876581316753 57602132235424755886206198685365216 93202207781383214849429075266681969 150804340016807970735635273952047185 244006547798191185585064349218729154 394810887814999156320699623170776339 638817435613190341905763972389505493 1033628323428189498226463595560281832 1672445759041379840132227567949787325 2706074082469569338358691163510069157 4378519841510949178490918731459856482 7084593923980518516849609894969925639 11463113765491467695340528626429782121 18547707689471986212190138521399707760
# Extrapolated from [3@21, 144@77]: (144 - 3) / (77 - 21)
eval instant at 80s rate(metric[1m])
eval instant at 80s rate(metric_total[1m])
{} 2.517857143
# Extrapolated to range start for counter, [2@20, 144@80]: (144 - 2) / (80 - 20)
eval instant at 80s rate(metric[1m500ms:10s])
eval instant at 80s rate(metric_total[1m500ms:10s])
{} 2.3666666666666667
# Extrapolated to zero value for counter, [2@20, 144@80]: (144 - 0) / 61
eval instant at 80s rate(metric[1m1s:10s])
eval instant at 80s rate(metric_total[1m1s:10s])
{} 2.360655737704918
# Only one value between 10s and 20s, 2@14
eval instant at 20s min_over_time(metric[10s])
eval instant at 20s min_over_time(metric_total[10s])
{} 2
# min(2@20)
eval instant at 20s min_over_time(metric[15s:10s])
eval instant at 20s min_over_time(metric_total[15s:10s])
{} 1
eval instant at 20m min_over_time(rate(metric[5m])[20m:1m])
eval instant at 20m min_over_time(rate(metric_total[5m])[20m:1m])
{} 0.12119047619047618

Loading…
Cancel
Save