Introduced in: v25.10.0
Computes quantile of a histogram using linear interpolation, taking into account the cumulative value and upper bounds of each histogram bucket.
To get the interpolated value, all the passed values are combined into an array, which are then sorted by their corresponding bucket upper bound values. Quantile interpolation is then performed similarly to the PromQL histogram_quantile() function on a classic histogram, performing a linear interpolation using the lower and upper bound of the bucket in which the quantile position is found.
See Also
Syntax
quantilePrometheusHistogram(level)(bucket_upper_bound, cumulative_bucket_value)Arguments
bucket_upper_bound— Upper bounds of the histogram buckets. The highest bucket must have an upper bound of+Inf.Float*cumulative_bucket_value— Cumulative values of the histogram buckets. Values must be monotonically increasing as the bucket upper bound increases.UInt*orFloat*
Returned value
Returns the quantile of the specified level. The floating-point type of the result matches the type of bucket_upper_bound. Float32 or Float64
Examples
Usage example
SELECT quantilePrometheusHistogram(bucket_upper_bound, cumulative_bucket_value)
FROM VALUES('bucket_upper_bound Float64, cumulative_bucket_value UInt64', (0, 6), (0.5, 11), (1, 14), (inf, 19));┌─quantilePrometheusHistogram(bucket_upper_bound, cumulative_bucket_value)─┐
│ 0.35 │
└──────────────────────────────────────────────────────────────────────────┘