mirror of
https://github.com/prometheus/prometheus.git
synced 2024-12-25 21:54:10 -08:00
Merge pull request #9553 from prometheus/beorn7/histogram
promql: Add more test cases for `histogram_quantile`
This commit is contained in:
commit
c092a74be9
28
promql/testdata/histograms.test
vendored
28
promql/testdata/histograms.test
vendored
|
@ -15,6 +15,15 @@ load 5m
|
||||||
testhistogram_bucket{le="0.3", start="negative"} 0+2x10
|
testhistogram_bucket{le="0.3", start="negative"} 0+2x10
|
||||||
testhistogram_bucket{le="+Inf", start="negative"} 0+3x10
|
testhistogram_bucket{le="+Inf", start="negative"} 0+3x10
|
||||||
|
|
||||||
|
# Another test histogram, where q(1/6), q(1/2), and q(5/6) are each in
|
||||||
|
# the middle of a bucket and should therefore be 1, 3, and 5,
|
||||||
|
# respectively.
|
||||||
|
load 5m
|
||||||
|
testhistogram2_bucket{le="0"} 0+0x10
|
||||||
|
testhistogram2_bucket{le="2"} 0+1x10
|
||||||
|
testhistogram2_bucket{le="4"} 0+2x10
|
||||||
|
testhistogram2_bucket{le="6"} 0+3x10
|
||||||
|
testhistogram2_bucket{le="+Inf"} 0+3x10
|
||||||
|
|
||||||
# Now a more realistic histogram per job and instance to test aggregation.
|
# Now a more realistic histogram per job and instance to test aggregation.
|
||||||
load 5m
|
load 5m
|
||||||
|
@ -91,6 +100,25 @@ eval instant at 50m histogram_quantile(0.8, rate(testhistogram_bucket[5m]))
|
||||||
{start="positive"} 0.72
|
{start="positive"} 0.72
|
||||||
{start="negative"} 0.3
|
{start="negative"} 0.3
|
||||||
|
|
||||||
|
# Want results exactly in the middle of the bucket.
|
||||||
|
eval instant at 7m histogram_quantile(1./6., testhistogram2_bucket)
|
||||||
|
{} 1
|
||||||
|
|
||||||
|
eval instant at 7m histogram_quantile(0.5, testhistogram2_bucket)
|
||||||
|
{} 3
|
||||||
|
|
||||||
|
eval instant at 7m histogram_quantile(5./6., testhistogram2_bucket)
|
||||||
|
{} 5
|
||||||
|
|
||||||
|
eval instant at 47m histogram_quantile(1./6., rate(testhistogram2_bucket[15m]))
|
||||||
|
{} 1
|
||||||
|
|
||||||
|
eval instant at 47m histogram_quantile(0.5, rate(testhistogram2_bucket[15m]))
|
||||||
|
{} 3
|
||||||
|
|
||||||
|
eval instant at 47m histogram_quantile(5./6., rate(testhistogram2_bucket[15m]))
|
||||||
|
{} 5
|
||||||
|
|
||||||
# Aggregated histogram: Everything in one.
|
# Aggregated histogram: Everything in one.
|
||||||
eval instant at 50m histogram_quantile(0.3, sum(rate(request_duration_seconds_bucket[5m])) by (le))
|
eval instant at 50m histogram_quantile(0.3, sum(rate(request_duration_seconds_bucket[5m])) by (le))
|
||||||
{} 0.075
|
{} 0.075
|
||||||
|
|
Loading…
Reference in a new issue