Skip to main content

get_bound

Function get_bound 

Source
fn get_bound(idx: i32, schema: i32, custom_values: &[f64]) -> Option<f64>
Expand description

The bound of bucket idx: a custom bound, an infinity sentinel, or 2^(idx / 2^schema).

The exponential case computes its bound instead of reading one, while Prometheus reads ExponentialBounds: those entries are not all correctly rounded, because a bound becomes a zero threshold that is compared exactly, and a computed one would not compare as the sender’s did. So the computed bound here agrees with the table the native histogram kernel uses only to within an ulp. This function keeps serving the renderers and the estimators of this crate’s public NativeHistogram API (promql_string, estimated_stdvar, the legacy quantile above, the zero-threshold reconciliation in add); the PromQL estimators read the kernel’s bound.