Skip to main content

Module float_histogram

Module float_histogram 

Source
Expand description

Arithmetic on owned native histograms, following Prometheus FloatHistogram (model/histogram/float_histogram.go): Add, KahanAdd, Sub, Mul, Div, Compact, CopyToSchema, DetectReset and Equals, including zero bucket reconciliation, resolution reduction and the intersection of mismatched custom bounds.

Each side is a list of (bucket index, count) sorted by index. Go splices span layouts in place; the bucket indices and the order of additions to each bucket do not depend on the layout, so the results are the same.

Structsยง

AddOutcome ๐Ÿ”’
What an addition or subtraction reports besides its result.
FloatHistogram ๐Ÿ”’
A native histogram with absolute bucket counts.
RollUp ๐Ÿ”’
The rolling sum of custom buckets up to a bound, as Goโ€™s rollupSumForBound closure keeps it across calls.

Functionsยง

add_buckets ๐Ÿ”’
Go addBuckets and kahanAddBuckets: adds sign * other to one side of h, inserting the buckets h lacks. Leading buckets of other inside the zero bucket are skipped.
add_custom_buckets_with_mismatches ๐Ÿ”’
Go addCustomBucketsWithMismatches: maps both sides onto the intersected bounds, adding with Kahan summation, and drops buckets left empty. Returns the buckets and their compensation.
canonical_spans ๐Ÿ”’
Spans with one span per run of consecutive indices.
check_schemas ๐Ÿ”’
compact_with ๐Ÿ”’
Go kahanCompact(0): drops the buckets whose count and compensation are both zero.
incompatible_schema ๐Ÿ”’
intersect_custom_bounds ๐Ÿ”’
Go intersectCustomBucketBounds.
iterate ๐Ÿ”’
Go floatBucketIterator: the buckets of side merged down to target, without the leading ones whose upper bound is at most threshold.
kahan_reduce_resolution ๐Ÿ”’
Go kahanReduceResolution.
reduce_resolution ๐Ÿ”’
Go reduceResolution without delta encoding.
side_from_view ๐Ÿ”’
side_reset ๐Ÿ”’
Go detectReset over two sides with matching indices.
spans_match ๐Ÿ”’
Go spansMatch: equal layouts once zero-length spans are folded into the next span.
target_index ๐Ÿ”’
Go targetIdx.
zero_compensation ๐Ÿ”’

Type Aliasesยง

Buckets ๐Ÿ”’