mirror of
https://github.com/prometheus/prometheus.git
synced 2025-09-21 13:51:00 +02:00
Merge pull request #17141 from prometheus/beorn7/histogram3
promql: Use `HistogramStatsIterator` more often
This commit is contained in:
commit
d7e9a2ffb0
@ -350,6 +350,14 @@ func BenchmarkNativeHistograms(b *testing.B) {
|
|||||||
name: "histogram_count with long rate interval",
|
name: "histogram_count with long rate interval",
|
||||||
query: "histogram_count(sum(rate(native_histogram_series[20m])))",
|
query: "histogram_count(sum(rate(native_histogram_series[20m])))",
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
name: "two-legged histogram_count/sum with short rate interval",
|
||||||
|
query: "histogram_count(sum(rate(native_histogram_series[2m]))) + histogram_sum(sum(rate(native_histogram_series[2m])))",
|
||||||
|
},
|
||||||
|
{
|
||||||
|
name: "two-legged histogram_count/sum with long rate interval",
|
||||||
|
query: "histogram_count(sum(rate(native_histogram_series[20m]))) + histogram_sum(sum(rate(native_histogram_series[20m])))",
|
||||||
|
},
|
||||||
}
|
}
|
||||||
|
|
||||||
opts := promql.EngineOpts{
|
opts := promql.EngineOpts{
|
||||||
|
@ -3920,7 +3920,7 @@ func detectHistogramStatsDecoding(expr parser.Expr) {
|
|||||||
break pathLoop
|
break pathLoop
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return errors.New("stop")
|
return nil
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1660,3 +1660,20 @@ eval instant at 30s histogram_count(avg(reset))
|
|||||||
eval instant at 5m histogram_count(rate(reset{timing="late"}[5m]))
|
eval instant at 5m histogram_count(rate(reset{timing="late"}[5m]))
|
||||||
expect no_warn
|
expect no_warn
|
||||||
{timing="late"} 0.0175
|
{timing="late"} 0.0175
|
||||||
|
|
||||||
|
clear
|
||||||
|
|
||||||
|
# Test edge cases of HistogramStatsIterator detection.
|
||||||
|
# We access the same series multiple times within the same expression,
|
||||||
|
# once with and once without HistogramStatsIterator. The results here
|
||||||
|
# at least prove that we do not use HistogramStatsIterator where we
|
||||||
|
# should not.
|
||||||
|
load 1m
|
||||||
|
histogram {{schema:0 count:10 sum:50 counter_reset_hint:gauge buckets:[1 2 3 4]}}
|
||||||
|
|
||||||
|
eval instant at 1m histogram_count(histogram unless histogram_quantile(0.5, histogram) < 3)
|
||||||
|
{} 10
|
||||||
|
|
||||||
|
eval instant at 1m histogram_quantile(0.5, histogram unless histogram_count(histogram) == 0)
|
||||||
|
{} 3.1748021039363987
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user