Skip to main content

Module state

Module state 

Source
Expand description

Partial aggregation: the state one execution partition folds its series into, and the merge of such states into the final result.

A merge regroups the operations of a serial fold, so floating-point results differ from aggregate_float by rounding. The same reassociation can also move an overflow of finite values: a serial sum of [1e308, 1e308, -1e308] is +Inf, while the merge of [1e308] and [1e308, -1e308] is finite. stddev and stdvar differ more where the samples differ by little more than the rounding of their mean: Prometheus’ uncompensated Welford update rounds the mean on every sample, and no pairwise merge reproduces those roundings. For [1e16] and [1e16 + 2] Prometheus gives a variance of 2 and the merge gives the exact 1. Explicit NaN and infinite inputs follow the same rules as the serial fold. Where the serial fold keeps the first of two equal values, as min and max do for 0 and -0, a merge keeps the one merged first.

Structs§

AccumulatorState
The state of one field of one group at one grid point.
FloatMerger
Merges the partial states of one aggregation into its result. Groups are identified by their full label set, already grouped by the partitions, and keep the order they first arrive in.
PartialAggregate
The state of one execution partition, with its groups in the order they first appeared.
StateRow
One Arrow-backed aggregate state row, independent of executor plumbing.

Enums§

StateField
A component of AccumulatorState.

Constants§

HISTOGRAM_LAYOUT_ROW_BYTES 🔒
Bytes one one-row batch of the frame’s histogram layout costs before its bucket data.

Functions§

add_compensated 🔒
The compensated sum of two partial sums. Both the other sum and its compensation are added as Kahan addends: adding the compensation plainly would drop what the compensation already holds once later partials cancel the sums, as merging [1e100, 1], [-1e100, 1e84] and [-1e84] would lose the 1.
exported_payload_bytes 🔒
Bytes one exported point’s payload builds: the boxed state and the two one-row batches HistogramAccumulator::payload makes from the accumulator’s live histogram and its compensation.
extend_spans 🔒
Appends position to spans, extending the last run when it continues.
histogram_state_at 🔒
One present field’s histogram state at one position, read from the row’s component arrays.
key_bytes 🔒
Bytes a group’s label key holds: a pair per capacity slot, and the __name__ entry, whose label and value label_key copies, each with its own Arc header. The other label strings are the metric’s, already counted with it.
key_workspace_bytes 🔒
Coarse bytes the key of metric holds while it is built: a pair per slot, the __name__ label and a copy of the metric name, each with its Arc header.
mean_form 🔒
The mean and its compensation, converting a sum as the serial update does on switching.
merge_avg 🔒
Adds the sums while they stay finite, and otherwise continues with the count-weighted mean, as the serial update switches to an incremental mean once its sum overflows.
merge_count_values
Merges count_values results of several partitions. Each partial already carries its full output label set, value label included, so series with one label set add their counts point by point and field by field.
missing_payload_component 🔒
payload_bool 🔒
payload_float 🔒
payload_histogram 🔒
seen_points 🔒
The points of group that carry a state: the ones a partial of it holds.
state_at 🔒
One present field’s state at one position, read from the row’s component arrays.
state_partial 🔒
The exported form of the state in words, or None if it has seen no sample.