mirror of
https://github.com/prometheus/prometheus.git
synced 2025-08-07 06:37:17 +02:00
promqltest: Test NaN sample values for quantile aggregator
Signed-off-by: beorn7 <beorn@grafana.com>
This commit is contained in:
parent
181415c7b7
commit
107e4a00c3
26
promql/promqltest/testdata/aggregators.test
vendored
26
promql/promqltest/testdata/aggregators.test
vendored
@ -462,19 +462,34 @@ load 10s
|
|||||||
data{test="uneven samples",point="a"} 0
|
data{test="uneven samples",point="a"} 0
|
||||||
data{test="uneven samples",point="b"} 1
|
data{test="uneven samples",point="b"} 1
|
||||||
data{test="uneven samples",point="c"} 4
|
data{test="uneven samples",point="c"} 4
|
||||||
|
data{test="NaN sample",point="a"} 0
|
||||||
|
data{test="NaN sample",point="b"} 1
|
||||||
|
data{test="NaN sample",point="c"} NaN
|
||||||
data_histogram{test="histogram sample", point="c"} {{schema:2 count:4 sum:10 buckets:[1 0 0 0 1 0 0 1 1]}}
|
data_histogram{test="histogram sample", point="c"} {{schema:2 count:4 sum:10 buckets:[1 0 0 0 1 0 0 1 1]}}
|
||||||
foo 0 1 0 1 0 1 0.8
|
foo 0 1 0 1 0 1 0.8
|
||||||
|
|
||||||
|
# 80th percentile.
|
||||||
|
# The NaN sample is treated as the smallest possible value.
|
||||||
eval instant at 1m quantile without(point)(0.8, data)
|
eval instant at 1m quantile without(point)(0.8, data)
|
||||||
{test="two samples"} 0.8
|
{test="two samples"} 0.8
|
||||||
{test="three samples"} 1.6
|
{test="three samples"} 1.6
|
||||||
{test="uneven samples"} 2.8
|
{test="uneven samples"} 2.8
|
||||||
|
{test="NaN sample"} 0.6
|
||||||
|
|
||||||
|
# 20th percentile.
|
||||||
|
# A quantile between NaN and 0 is interpolated as NaN.
|
||||||
|
eval instant at 1m quantile without(point)(0.2, data)
|
||||||
|
{test="two samples"} 0.2
|
||||||
|
{test="three samples"} 0.4
|
||||||
|
{test="uneven samples"} 0.4
|
||||||
|
{test="NaN sample"} NaN
|
||||||
|
|
||||||
# The histogram is ignored here so the result doesn't change but it has an info annotation now.
|
# 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_info instant at 1m quantile without(point)(0.8, {__name__=~"data(_histogram)?"})
|
||||||
{test="two samples"} 0.8
|
{test="two samples"} 0.8
|
||||||
{test="three samples"} 1.6
|
{test="three samples"} 1.6
|
||||||
{test="uneven samples"} 2.8
|
{test="uneven samples"} 2.8
|
||||||
|
{test="NaN sample"} 0.6
|
||||||
|
|
||||||
# The histogram is ignored here so there is no result but it has an info annotation now.
|
# 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_info instant at 1m quantile(0.8, data_histogram)
|
||||||
@ -484,24 +499,27 @@ eval instant at 1m quantile without(point)(scalar(foo), data)
|
|||||||
{test="two samples"} 0.8
|
{test="two samples"} 0.8
|
||||||
{test="three samples"} 1.6
|
{test="three samples"} 1.6
|
||||||
{test="uneven samples"} 2.8
|
{test="uneven samples"} 2.8
|
||||||
|
{test="NaN sample"} 0.6
|
||||||
|
|
||||||
eval instant at 1m quantile without(point)((scalar(foo)), data)
|
eval instant at 1m quantile without(point)((scalar(foo)), data)
|
||||||
{test="two samples"} 0.8
|
{test="two samples"} 0.8
|
||||||
{test="three samples"} 1.6
|
{test="three samples"} 1.6
|
||||||
{test="uneven samples"} 2.8
|
{test="uneven samples"} 2.8
|
||||||
|
{test="NaN sample"} 0.6
|
||||||
|
|
||||||
eval instant at 1m quantile without(point)(NaN, data)
|
eval instant at 1m quantile without(point)(NaN, data)
|
||||||
expect warn msg: PromQL warning: quantile value should be between 0 and 1, got NaN
|
expect warn msg: PromQL warning: quantile value should be between 0 and 1, got NaN
|
||||||
{test="two samples"} NaN
|
{test="two samples"} NaN
|
||||||
{test="three samples"} NaN
|
{test="three samples"} NaN
|
||||||
{test="uneven samples"} NaN
|
{test="uneven samples"} NaN
|
||||||
|
{test="NaN sample"} NaN
|
||||||
|
|
||||||
# Bug #15971.
|
# Bug #15971.
|
||||||
eval range from 0m to 1m step 10s quantile without(point) (scalar(foo), data)
|
eval range from 0m to 1m step 10s quantile without(point) (scalar(foo), data)
|
||||||
{test="two samples"} 0 1 0 1 0 1 0.8
|
{test="two samples"} 0 1 0 1 0 1 0.8
|
||||||
{test="three samples"} 0 2 0 2 0 2 1.6
|
{test="three samples"} 0 2 0 2 0 2 1.6
|
||||||
{test="uneven samples"} 0 4 0 4 0 4 2.8
|
{test="uneven samples"} 0 4 0 4 0 4 2.8
|
||||||
|
{test="NaN sample"} NaN 1 NaN 1 NaN 1 0.6
|
||||||
|
|
||||||
# Tests for group.
|
# Tests for group.
|
||||||
clear
|
clear
|
||||||
|
Loading…
Reference in New Issue
Block a user