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§
- Aggregate
State Schema - The layout of intermediate aggregate state.
- Bound
Aggregate - An aggregate bound to its kind, grouping and stage.
- Bound
Input - A scan or exchange boundary bound as a node input.
- Bound
Instant - An instant selection: the last sample at or before each grid point, within a lookback.
- Bound
Map - A chain of point-wise operations applied to a whole evaluated value.
- Bound
Scalar - A constant scalar bound for broadcast or a statement root.
- Bound
SetOp - A set operator and the labels its two vectors are matched by.
- Bound
Window - A window function over raw samples or over an evaluated input.
- Native
Node - One node of a bound tree.
- Native
Tree - A bound evaluation tree.
Enums§
- Aggregate
Kind - Which aggregate a node computes.
- Aggregate
Stage - Where an aggregate sits in the execution, which decides whether its output is a query value.
- Bound
Vector Op - 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.
- Instant
Value - 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.
- Native
Expr - What a node computes. Every variant holds a bound operation, never a name to resolve.
- Native
Type - What one node produces.
- Parameterized
Op - 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
MathOpin aBoundMap.
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::validatelevel 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
opoverinputwith the layoutnodedeclares. - answers_
one_ 🔒series_ per_ label_ set - Whether
nodeanswers 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
leftandrightis 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::Mergecollects the seriesnodehands over, at it or below it. - drops_
metadata_ 🔒labels_ over_ one_ metric - Whether
nodedropsPROMQL_METADATA_LABELSon 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
declaredfields where its input providesexpected. - ensure_
grid 🔒 - Checks that
tyis evaluated on the gridexpecteddescribes. - ensure_
not_ 🔒interleaved - Checks that
input, when it is aNativeExpr::Input, does not declare interleaved series. - ensure_
same_ 🔒fields - Checks that a node declares the field layout its input produces.
- ensure_
samples 🔒 - Checks that
typroduces samples and returns them. - evaluated_
vector 🔒 - The schema and grid of an evaluated vector, or
Nonewhentyis 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
groupnames, 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 waygroupasks. - invalid 🔒
- keeps_
metric_ 🔒name - Whether a binary operation reports the samples of the side it keeps, name included.
- kernel_
grouping 🔒 groupspelled with the kernel’s ownGrouping, over the labelsgroup_namesreports for it:byandwithoutare not interchangeable to the kernel.- leaves_
a_ drop_ to_ the_ storage_ keys - Whether
treeholds a node that drops the metadata labels over series whose labels are proved to tell apart and whose keys are not (seedrops_metadata_labels_over_one_metric). - map_
writes_ 🔒existing_ label - Whether
op, applied toinput’s series, writes a label those series already carry. - merge_
shape_ 🔒supported - Whether
nodeis a supported child of aNativeExpr::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
nodeand every input below it is a shape the runtime builds. - native_
node_ 🔒supported_ within_ stack native_node_supportedone tree level down.- native_
tree_ supported - Whether the native runtime executes
tree, answered from the tree itself. - reads_
across_ series - Whether
nodereads the whole input vector at a point rather than one series at a time. - single_
metric_ 🔒name - The one metric every series
nodehands over is named, orNonewhen this walk cannot say. - single_
source_ 🔒metric - The one metric every source
nodereads is bound to, orNonewhen they are not all one. - unifies_
its_ own_ contributions - Whether
nodehands over one logical series per canonical label set, or several. - uniform_
field_ kind - The
FieldKindevery referenced field of a scan carries, orNonewhen they disagree or one is a type this route does not answer. - vector_
op_ 🔒supported - Whether
opis an operation the vector kernel runs over a vector ofschema. - window_
instants_ 🔒fit - Whether the runtime can compute the timestamps
opreads. - window_
modifier_ 🔒supported - Whether the runtime evaluates
opoverinput, 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.