Skip to main content

Module vector_match

Module vector_match 

Source
Expand description

Vectorโ€“vector binary and set operations over evaluated series on one grid.

Semantics follow Prometheus VectorBinop, VectorAnd, VectorOr and VectorUnless evaluated at every grid point. Series are processed whole, over their own grid ranges, and the cardinality rules are checked per point: series sharing a match group only conflict at points where both are present. Each field is matched on its own, as if the operands held only that field; the results of all fields with one label set form one series.

Structsยง

BinaryMatching
A vectorโ€“vector binary operation with its modifiers.
Budget ๐Ÿ”’
The live workspace a binary, set or info operation admits as it allocates, at three granularities.
Duplicate ๐Ÿ”’
Two rows of one result label set at one point.
DuplicateCandidate
The best duplicate candidate retained for one grid point.
DuplicateEvidence
A per-node, per-field reduction of duplicate evidence across output partitions.
DuplicateSlot ๐Ÿ”’
FieldEvidence ๐Ÿ”’
FieldMetadata ๐Ÿ”’
The figures one fieldโ€™s phases are charged from, read once from its operands.
FillValues
The values of fill, fill_left and fill_right, which stand in for a sample that has no match on the other side: lhs for a missing left-hand sample and rhs for a missing right-hand one, as the query writes them, group_right included (prometheus/prometheus#19939).
NodeEvidence ๐Ÿ”’
binary_vectors, handing the live workspace it holds to reserve as it allocates.
Operand ๐Ÿ”’
One field of one sideโ€™s series, with verified grid axes.
Pairs ๐Ÿ”’
The matched pairs of one field and the state Prometheus checks them against.
ResultRows ๐Ÿ”’
Rows in arrival order: their points, the match group each came from, and their values; None is a match the operator filtered.
ResultTotals ๐Ÿ”’
The rows filed, the rows holding a value, the rows holding a histogram and the heap those histograms hold: counted as each row is filed, so neither later phase walks them again.
Results ๐Ÿ”’
The result rows of one field by result label set.
SetFieldMetadata ๐Ÿ”’
The figures one set fieldโ€™s phases are charged from, read once from its operands.

Enumsยง

BinaryKind
What a BinaryOp computes: arithmetic over two values or a comparison of them.
BinaryOp
A PromQL binary operator between two instant vectors.
Cardinality
How many series of each side may share a match group.
MatchingLabels
The labels two series are matched by.
RowSlot ๐Ÿ”’
One pairingโ€™s result row, opened by the first point the pairing files.
SetOp
A PromQL set operator between two instant vectors.

Constantsยง

ERROR_TEXT_BYTES ๐Ÿ”’
The fixed text of one error message, around the label set it renders.
GROUP_SLOT_BYTES ๐Ÿ”’
One entry of a match-group table, with the control byte and spare capacity it keeps.
HISTOGRAM_ROW_BYTES ๐Ÿ”’
One row of the builderโ€™s histogram table: the scalar columns and the seven list offsets.
KEY_LABEL_BYTES ๐Ÿ”’
One label of a match key, charged twice because group_key grows its Vec by doubling.
MATCHING_NAME_BYTES ๐Ÿ”’
One name of MatchingLabels, which result_metric collects into a reference vector. The vector is collected from an exact-size iterator, so its buffer holds one &str per name.
MATCH_SLOT_BYTES ๐Ÿ”’
One entry of the one-to-one match set, charged the same way.
MERGE_SLOT_BYTES ๐Ÿ”’
One row of the mergeโ€™s table, charged the same way.
RESULT_ROW_BYTES ๐Ÿ”’
One row of a fieldโ€™s results: its point, its match group and its value. The three vectors grow together, so one slot of each is what a row takes, and a block of the vectors is charged a rowโ€™s bytes per slot it grew by.
RESULT_SLOT_BYTES ๐Ÿ”’
One entry of a fieldโ€™s result table, charged the same way.
SORT_ROW_BYTES ๐Ÿ”’
One row while a label set is sorted: the old and the new copy of its point, group and value vectors, and the row order the sort reads. The sort copies a label setโ€™s rows when they are not already in order, so this is what one row costs while it runs.
VEC_MIN_CAPACITY ๐Ÿ”’
The capacity a fresh Vec holds: a first push allocates four entries, and a full one doubles.

Functionsยง

binary_field ๐Ÿ”’
Matches one field of each side, collecting the first failure of each kind as (point, rank, message).
binary_output_schema
The schema of binary_vectors output: fields paired by position, named after the left side.
binary_vectors
Applies matching to every pair of matched series at every grid point.
binary_vectors_inner ๐Ÿ”’
The one binary kernel: one walk, one lookup and one error order, whether or not a caller accounts for the workspace. Every figure is reserved only when budget is held.
binary_vectors_with_reservation ๐Ÿ”’
candidate_owned_bytes ๐Ÿ”’
copied_bytes ๐Ÿ”’
The label text result_metric copies from the one side: the value of every included label it sets, and the name of a label it inserts, since SeriesLabels::set copies that as well.
duplicate_message ๐Ÿ”’
earliest_error ๐Ÿ”’
elem_binop ๐Ÿ”’
Prometheus vectorElemBinop over present samples: the value and whether to keep it, or None when Prometheus reports the pair as an annotation and skips it without counting the match: an operator the sample types do not support, or an addition or subtraction of histograms that mix exponential and custom buckets or whose counter reset hints contradict.
field_metadata_bytes ๐Ÿ”’
The figures one fieldโ€™s phases are charged from.
group ๐Ÿ”’
Groups the series of operand by their match group.
group_key ๐Ÿ”’
group_presence ๐Ÿ”’
The points at which each match group of operand holds a sample, one bit per grid point.
histogram_phase_bytes ๐Ÿ”’
The bytes one row of a histogram operator holds at its peak, read once from the widest histogram of each side of a field: an owned copy of each operand, the union + and - grow into โ€“ both sidesโ€™ buckets, charged twice because the union reallocates while the old buffer is alive โ€“ the custom bounds the wider side copies, and the value the operator boxes. A phase figure, not one per row: a row that pairs two histograms is bounded by the widest of each side.
key_of ๐Ÿ”’
label_text_bytes ๐Ÿ”’
The bytes render writes for a label set built from metric: each label as name="value", the braces and separators between them, and the metricโ€™s name.
match_key_bytes ๐Ÿ”’
The bytes one match key holds: its label pairs and, for on(...), a copy of each value.
merge_bytes ๐Ÿ”’
The bytes the merge of every fieldโ€™s results and the builder writing them out allocate.
merge_fields ๐Ÿ”’
Joins the per-field results into series with all fields, by label set.
merge_multi_field ๐Ÿ”’
The merge of every fieldโ€™s results into one series per label set: the (point, field, value) triples of a label set, sorted and filled into a row the builder writes one value per point.
merge_series_columns ๐Ÿ”’
The bytes one result seriesโ€™ columns take, read from the triples the multi-field merge sorts: the points they sit at, one row per point.
merge_series_columns_of ๐Ÿ”’
The bytes one result seriesโ€™ columns take: the rows it writes โ€“ one per distinct point of its samples, which is what the builder writes a row for โ€“ times a rowโ€™s columns. The points arrive sorted, so a distinct point is a point that differs from the one before it.
merge_single_field ๐Ÿ”’
The one-field shapeโ€™s merge: the label setโ€™s rows written out as they are read.
metric_of ๐Ÿ”’
The labels Prometheus gives a fill sample: the match group of the sample it pairs with.
output_bytes ๐Ÿ”’
The bytes the operationโ€™s own descriptors cost: one result table per paired field, the field list the results and the output schema each keep, and the schema struct.
overlap ๐Ÿ”’
Reports every point where two or more members are present.
owned_histogram_bytes ๐Ÿ”’
The bytes one owned copy of a histogram view holds: its scalars inline, and on the heap the buckets of both sides, the span layout of the view and its custom bounds.
pair_bytes ๐Ÿ”’
The bytes one pairing allocates before it files a row: the result label set result_metric rewrites, the group_* labels it copies in, the reference vector it collects the matching label names into, and the key its rows are looked up by.
render ๐Ÿ”’
result_histogram_bytes ๐Ÿ”’
The bytes one boxed histogram value holds: its scalars inline and the heap its buckets, bounds and span layout own.
result_key_bytes ๐Ÿ”’
The key key_of files a result label set under: every label with a value and the name, each charged twice for the growth of the keyโ€™s Vec, plus the name string it copies.
result_metric ๐Ÿ”’
result_set_bytes ๐Ÿ”’
The bytes one result label set keeps once a row is filed under it: the label list and the copied strings result_metric leaves behind, its key and its entry in the result table.
same_grid ๐Ÿ”’
same_labelset ๐Ÿ”’
set_field ๐Ÿ”’
Filters one field of the kept side by the presence of its match group on the filter side, and appends the first point where two kept rows share a label set as (point, rank, message).
set_field_metadata ๐Ÿ”’
set_vectors
Applies a set operator at every grid point. Series keep their labels and values; fields are paired by position.
set_vectors_inner ๐Ÿ”’
The one set kernel, whether or not a caller accounts for its workspace.
set_vectors_with_reservation ๐Ÿ”’
set_vectors, handing the live workspace it holds to reserve as it allocates.
unsupported_histogram_arithmetic ๐Ÿ”’
The legacy Info applies only to unsupported histogram arithmetic, not to other reasons a supported histogram operation can decline a pair (such as incompatible bucket layouts).
validate_binary_operand ๐Ÿ”’
Validates one operand of binary_vectors: every series must sit on the schemaโ€™s grid, carry the schemaโ€™s fields, and hold one sample for every row its own axis places.
widest_metric ๐Ÿ”’
The series of operand with the most labels: the widest label set one pairing of its field can build.

Type Aliasesยง

GroupKey
Label pairs identifying a match group or a result; empty values are absent, as in Prometheus.