mirror of
https://github.com/prometheus/prometheus.git
synced 2025-12-04 17:11:13 +01:00
Signed-off-by: Andrew Hall <andrew.hall@grafana.com> Co-authored-by: Charles Korn <charleskorn@users.noreply.github.com> Co-authored-by: Arve Knudsen <arve.knudsen@gmail.com>
107 lines
2.2 KiB
Plaintext
107 lines
2.2 KiB
Plaintext
# sum_over_time with all values
|
|
load 15s
|
|
bar 0 1 10 100 1000
|
|
|
|
eval range from 0 to 1m step 30s sum_over_time(bar[30s])
|
|
{} 0 11 1100
|
|
|
|
clear
|
|
|
|
# sum_over_time with trailing values
|
|
load 15s
|
|
bar 0 1 10 100 1000 0 0 0 0
|
|
|
|
eval range from 0 to 2m step 1m sum_over_time(bar[30s])
|
|
{} 0 1100 0
|
|
|
|
clear
|
|
|
|
# sum_over_time with all values long
|
|
load 30s
|
|
bar 0 1 10 100 1000 10000 100000 1000000 10000000
|
|
|
|
eval range from 0 to 4m step 1m sum_over_time(bar[30s])
|
|
{} 0 10 1000 100000 10000000
|
|
|
|
clear
|
|
|
|
# sum_over_time with all values random
|
|
load 15s
|
|
bar 5 17 42 2 7 905 51
|
|
|
|
eval range from 0 to 90s step 30s sum_over_time(bar[30s])
|
|
{} 5 59 9 956
|
|
|
|
clear
|
|
|
|
# metric query
|
|
load 30s
|
|
metric 1+1x4
|
|
|
|
eval range from 0 to 2m step 1m metric
|
|
metric 1 3 5
|
|
|
|
clear
|
|
|
|
# metric query with trailing values
|
|
load 30s
|
|
metric 1+1x8
|
|
|
|
eval range from 0 to 2m step 1m metric
|
|
metric 1 3 5
|
|
|
|
clear
|
|
|
|
# short-circuit
|
|
load 30s
|
|
foo{job="1"} 1+1x4
|
|
bar{job="2"} 1+1x4
|
|
|
|
eval range from 0 to 2m step 1m foo > 2 or bar
|
|
foo{job="1"} _ 3 5
|
|
bar{job="2"} 1 3 5
|
|
|
|
clear
|
|
|
|
# Drop metric name
|
|
load 30s
|
|
requests{job="1", __address__="bar"} 100
|
|
|
|
eval range from 0 to 2m step 1m requests * 2
|
|
{job="1", __address__="bar"} 200 200 200
|
|
|
|
clear
|
|
|
|
load 10s
|
|
some_metric{env="a"} 1+1x5
|
|
some_metric{env="b"} 2+2x5
|
|
|
|
# Return a range vector - note the use of the expect range vector directive which defines expected range
|
|
eval instant at 1m some_metric[1m]
|
|
expect range vector from 10s to 1m step 10s
|
|
some_metric{env="a"} 2 3 4 5 6
|
|
some_metric{env="b"} 4 6 8 10 12
|
|
|
|
clear
|
|
|
|
load 1m
|
|
some_metric{env="1"} 0+1x4
|
|
some_metric{env="2"} 0+2x4
|
|
some_metric{env="3"} {{count:0}}+{{count:1}}x4
|
|
some_metric_with_stale_marker 0 1 stale 3
|
|
|
|
eval instant at 2m some_metric[2m]
|
|
expect range vector from 1m to 2m step 60s
|
|
some_metric{env="1"} 1 2
|
|
some_metric{env="2"} 2 4
|
|
some_metric{env="3"} {{count:1 counter_reset_hint:not_reset}} {{count:2 counter_reset_hint:not_reset}}
|
|
|
|
eval instant at 3m some_metric_with_stale_marker[3m]
|
|
expect range vector from 1m to 3m step 60s
|
|
some_metric_with_stale_marker{} 1 _ 3
|
|
|
|
eval instant at 1m some_nonexistent_metric[1m]
|
|
expect range vector from 10s to 1m step 10s
|
|
|
|
eval instant at 10m some_metric[1m]
|
|
expect range vector from 9m10s to 10m step 1m |