Merge pull request #15475 from prometheus/beorn7/promql

promql: Add NaN tests for avg and avg_over_time
pull/15480/head
Björn Rabenstein 2024-11-27 19:41:39 +01:00 committed by GitHub
commit a7264eb0d4
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 19 additions and 0 deletions

View File

@ -543,6 +543,7 @@ load 10s
data{test="bigzero",point="b"} -9.988465674311579e+307 data{test="bigzero",point="b"} -9.988465674311579e+307
data{test="bigzero",point="c"} 9.988465674311579e+307 data{test="bigzero",point="c"} 9.988465674311579e+307
data{test="bigzero",point="d"} 9.988465674311579e+307 data{test="bigzero",point="d"} 9.988465674311579e+307
data{test="value is nan"} NaN
eval instant at 1m avg(data{test="ten"}) eval instant at 1m avg(data{test="ten"})
{} 10 {} 10
@ -577,6 +578,10 @@ eval instant at 1m avg(data{test="-big"})
eval instant at 1m avg(data{test="bigzero"}) eval instant at 1m avg(data{test="bigzero"})
{} 0 {} 0
# If NaN is in the mix, the result is NaN.
eval instant at 1m avg(data)
{} NaN
# Test summing and averaging extreme values. # Test summing and averaging extreme values.
clear clear

View File

@ -713,6 +713,7 @@ load 10s
metric8 9.988465674311579e+307 9.988465674311579e+307 metric8 9.988465674311579e+307 9.988465674311579e+307
metric9 -9.988465674311579e+307 -9.988465674311579e+307 -9.988465674311579e+307 metric9 -9.988465674311579e+307 -9.988465674311579e+307 -9.988465674311579e+307
metric10 -9.988465674311579e+307 9.988465674311579e+307 metric10 -9.988465674311579e+307 9.988465674311579e+307
metric11 1 2 3 NaN NaN
eval instant at 55s avg_over_time(metric[1m]) eval instant at 55s avg_over_time(metric[1m])
{} 3 {} 3
@ -806,6 +807,19 @@ eval instant at 45s sum_over_time(metric10[1m])/count_over_time(metric10[1m])
eval instant at 1m sum_over_time(metric10[2m])/count_over_time(metric10[2m]) eval instant at 1m sum_over_time(metric10[2m])/count_over_time(metric10[2m])
{} 0 {} 0
# NaN behavior.
eval instant at 20s avg_over_time(metric11[1m])
{} 2
eval instant at 30s avg_over_time(metric11[1m])
{} NaN
eval instant at 1m avg_over_time(metric11[1m])
{} NaN
eval instant at 1m sum_over_time(metric11[1m])/count_over_time(metric11[1m])
{} NaN
# Test if very big intermediate values cause loss of detail. # Test if very big intermediate values cause loss of detail.
clear clear
load 10s load 10s