Skip to main content

Module plan

Module plan 

Source
Expand description

The bound tree a native PromQL evaluation compiles to.

A query is compiled into NativeTree: NativeNodes whose operations are already bound to kernels, fields and grids. Nothing in this module interprets a function name, resolves a label or picks a column at run time; those decisions are made before the tree exists, so the hot path only feeds batches to kernels it was handed.

The tree is also the unit of legality. NativeNode::validate checks the contract every operation states about its input, which is what lets a new combination of supported operations be an ordinary tree instead of another hand-written shape.

What the tree cannot express yet is deliberate for this stage: NativeExpr::Scalar holds a constant, so time() and scalar(v) have no node. The legality below is therefore about the operations that exist, not about PromQL’s whole surface.

Structs§

AggregateStateSchema
The layout of intermediate aggregate state.
BoundAggregate
An aggregate bound to its kind, grouping and stage.
BoundInput
A scan or exchange boundary bound as a node input.
BoundInstant
An instant selection: the last sample at or before each grid point, within a lookback.
BoundMap
A chain of point-wise operations applied to a whole evaluated value.
BoundScalar
A constant scalar bound for broadcast or a statement root.
BoundSetOp
A set operator and the labels its two vectors are matched by.
BoundWindow
A window function over raw samples or over an evaluated input.
NativeNode
One node of a bound tree.
NativeTree
A bound evaluation tree.

Enums§

AggregateKind
Which aggregate a node computes.
AggregateStage
Where an aggregate sits in the execution, which decides whether its output is a query value.
BoundVectorOp
An operator over the whole input vector at each grid point: one that keeps some of the input’s samples with their series’ labels and values, orders the series, reports where none is present, reads a classic histogram from its bucket series, or counts the samples sharing a value.
Grouping
How an aggregate’s groups are identified, in the binding’s own terms.
InstantValue
What an instant selection reports at a grid point for the sample it selected there.
MapOp
One operation of a map, applied to each series on its own: math over its float values, a function of its native histograms, or a change of its labels. Each can give two series one label set, which is why all live in a map.
NativeExpr
What a node computes. Every variant holds a bound operation, never a name to resolve.
NativeType
What one node produces.
ParameterizedOp
A math function whose scalar parameters are bound as nodes, because at least one of them varies per grid point; Prometheus reads each parameter at every step. With constant parameters the same function is a MathOp in a BoundMap.

Constants§

LE_LABEL 🔒
The bucket-bound label a classic histogram’s series carry, which the histogram function folds and its result does not report.
METRIC_NAME 🔒
The label a metric name is stored under, which a scan binds beside its tag columns rather than among them.
PROMQL_METADATA_LABELS 🔒
Metadata labels the runtime removes from histogram result label sets.
VALIDATE_STACK_GROWTH 🔒
Stack a growth adds when the reserve above is spent. It holds several levels of the same check.
VALIDATE_STACK_RED_ZONE 🔒
Stack one NativeNode::validate level needs below it before the check grows its stack.

Functions§

aggregate_output_kind
The kind an aggregate’s own output column carries.
aggregate_state_binding
Returns the state type implied by an aggregate over an input of field_kind, if that state can be merged across a partition boundary.
aggregate_supported 🔒
Whether the runtime folds op over input with the layout node declares.
answers_one_series_per_label_set 🔒
Whether node answers one series per label set by construction.
binary_output_field_kind
The output kind of a binary operation over two evaluated vectors, including fill pairs.
binary_supported 🔒
Whether a binary node over left and right is a shape the runtime builds.
broadcast_drops_labels 🔒
Whether a binary operation drops the metric name when one side is a scalar broadcast.
canonical_below 🔒
Whether a NativeExpr::Merge collects the series node hands over, at it or below it.
drops_metadata_labels_over_one_metric 🔒
Whether node drops PROMQL_METADATA_LABELS on its own over series whose labels are proved to tell apart and whose keys are not.
duplicates_canonical_labels
Whether this tree can hand over two series that share one canonical label set.
ensure_field_count 🔒
Checks that a node declares declared fields where its input provides expected.
ensure_grid 🔒
Checks that ty is evaluated on the grid expected describes.
ensure_not_interleaved 🔒
Checks that input, when it is a NativeExpr::Input, does not declare interleaved series.
ensure_same_fields 🔒
Checks that a node declares the field layout its input produces.
ensure_samples 🔒
Checks that ty produces samples and returns them.
evaluated_vector 🔒
The schema and grid of an evaluated vector, or None when ty is raw samples, a scalar or state.
float_state_binding 🔒
The numeric state one aggregate keeps, from the components its kernel declares.
fused_output_tags
A conservative set of reportable label names for node.
group_names 🔒
The labels group names, which is what the kernel’s grouping is built over.
grouped_output_tags 🔒
The labels an aggregate reports: the ones its grouping keeps among those its input carries.
grouping_supported 🔒
Whether the kernel folds schema’s series the way group asks.
invalid 🔒
keeps_metric_name 🔒
Whether a binary operation reports the samples of the side it keeps, name included.
kernel_grouping 🔒
group spelled with the kernel’s own Grouping, over the labels group_names reports for it: by and without are not interchangeable to the kernel.
leaves_a_drop_to_the_storage_keys
Whether tree holds a node that drops the metadata labels over series whose labels are proved to tell apart and whose keys are not (see drops_metadata_labels_over_one_metric).
map_writes_existing_label 🔒
Whether op, applied to input’s series, writes a label those series already carry.
merge_shape_supported 🔒
Whether node is a supported child of a NativeExpr::Merge, and the evaluated vector it hands over.
metadata_labels_keep_series_apart 🔒
Whether the metadata labels a rewrite drops are the only ones telling node’s series apart.
native_node_supported 🔒
Whether node and every input below it is a shape the runtime builds.
native_node_supported_within_stack 🔒
native_node_supported one tree level down.
native_tree_supported
Whether the native runtime executes tree, answered from the tree itself.
reads_across_series
Whether node reads the whole input vector at a point rather than one series at a time.
single_metric_name 🔒
The one metric every series node hands over is named, or None when this walk cannot say.
single_source_metric 🔒
The one metric every source node reads is bound to, or None when they are not all one.
unifies_its_own_contributions
Whether node hands over one logical series per canonical label set, or several.
uniform_field_kind
The FieldKind every referenced field of a scan carries, or None when they disagree or one is a type this route does not answer.
vector_op_supported 🔒
Whether op is an operation the vector kernel runs over a vector of schema.
window_instants_fit 🔒
Whether the runtime can compute the timestamps op reads.
window_modifier_supported 🔒
Whether the runtime evaluates op over input, with or without a range modifier.
without_metadata_labels 🔒
The labels a node reports after the metadata labels are dropped, which is what a kernel that computes a value of its own does to the samples it reports.