Expand description
The legacy native-histogram estimators, delegated to the native kernel.
prom_native_histogram_quantile and prom_native_histogram_fraction used to estimate with the
bucket walk inside NativeHistogram itself: exponential bucket bounds computed as 2^x, and a
forward walk from the lowest bucket only. The native kernel (histogram_eval) walks the same
histogram the way Prometheus does – the bound table in bounds and, for a quantile above the
median of a histogram whose sum is not NaN, a walk from the highest bucket down – so keeping
both estimators leaves two answers for one histogram that differ in their last places.
These functions read a [NativeHistogram] through the borrowed [HistogramView] that both
representations share, hand it to the kernel as the FloatHistogram the kernel owns, and
return the answer in the shape the legacy UDFs report it. The scalar arithmetic – add, sub,
scale, divide_by – takes the same route below the estimators, so Prometheus’s rules for
reconciling a zero bucket, reducing a schema and intersecting custom bounds live in one place.
Structs§
- Legacy
View 🔒 - A [
NativeHistogram] borrowed as a [HistogramView], the form the native kernel reads.
Functions§
- add 🔒
left + right, orNonefor a pair the kernel refuses to combine.- bucket_
counts 🔒 - bucket_
total 🔒 - What the populated buckets hold, summed in the order the kernel walks them: the negative side from its highest index down, the zero bucket, then the positive side upwards.
- combine 🔒
- divide_
by 🔒 histogram / divisor, with no buckets left for a zero divisor.- field_
divided 🔒 - field_
scaled 🔒 - float_
histogram 🔒 - The native kernel’s owned form of
histogram. - fraction_
with_ 🔒info histogram_fraction(lower, upper, histogram), with whether NaN observations were excluded.- legacy_
histogram 🔒 - The legacy representation of
histogram, with the span layout it carries. - legacy_
spans 🔒 - nan_
observation_ 🔒info - The note for a NaN observation, which the kernel accounts for but does not report.
- quantile_
with_ 🔒info histogram_quantile(q, histogram), with the NaN-observation note the legacy UDF records.- scale 🔒
histogram * factor, a gauge histogram for a negative factor.- span_
columns 🔒 - steps_
backwards 🔒 - Whether a span list steps backwards, which the legacy
bucket_indicesrefused. - sub 🔒
left - right, a gauge histogram the way Prometheus’s-leaves it.