histogram_fraction

histogram_fraction(histogram: histogram like, value: const numeric or duration) -> float64

Evaluates the cumulative distribution at a fixed threshold: it returns the approximate fraction of the distribution less than or equal to the given value. The threshold must be a compile-time float64 or duration constant so the comparison point is known during compilation. Although the first argument accepts any histogram-like type, only tdigest is implemented today; passing an OpenTelemetry histogram or exponential histogram value is a compile-time error with a histogram-type-not-supported message, so use a tdigest column produced by m_tdigest or tdigest. Like other histogram summaries, the result is an estimate rather than an exact CDF value.

Domain

This is a scalar function (calculates a single output value for a single input row).

Categories

Examples

make_col below_200ms:histogram_fraction(latency_digest, 0.2)

Computes the approximate fraction of a t-digest latency distribution at or below 200 milliseconds expressed as seconds.