Skip to main content

Module metric_sink

Module metric_sink 

Source
Expand description

Row-wise shaping for MetricSink sources.

A metric sink exports the rows of an existing collection into the in-process Prometheus metrics registry. The compute-side operator (mz_compute::sink::metric_sink) reads a canonical row shape and two planner-computed classification columns rather than parsing metric_type strings or validating metric names on its hot path. shape_metric_sink_source produces that shape.

Only the pure per-row shaping lives here. The cross-row logic (dedup, collision detection, family-conflict counting) stays in the operator, because it needs the frontier-gated fold that a per-row Map in MIR can’t express.

Structs§

GlobalLirPlan
The (final) result after MIR ⇒ LIR lowering and optimizing the resulting DataflowDescription with LIR plans.
GlobalMirPlan
The (sealed intermediate) result after embedding a MetricSink into a MirDataflowDescription, inlining referenced views, and jointly optimizing the MIR plans.
MetricSink
A wrapper of metric sink parts needed to start the optimization process.
Optimizer
Optimizer for metric sinks, both CREATE METRIC SINK and the coordinator-installed curated sinks.

Enums§

MetricSinkFrom
Where a metric sink’s rows come from.

Constants§

METRIC_NAME_PATTERN 🔒
Matches Prometheus’s metric name grammar: [a-zA-Z_:][a-zA-Z0-9_:]*.

Functions§

shape_metric_sink_source 🔒
Extends the metric sink’s source expression with the row-wise shaping the operator otherwise has to do in Rust: prepends the configured prefix to metric_name to form the published name, coalesces labels/help to their identity element, and adds two columns the operator reads instead of parsing strings on its hot path: