Skip to main content

Module metric_sink

Module metric_sink 

Source
Expand description

Coordinator-installed metric sinks, the curated counterpart to CREATE METRIC SINK.

A curated metric sink is a CURATED entry rendered on every replica, publishing its series into that replica’s process-local Prometheus registry. Unlike a user’s CREATE METRIC SINK it is not a catalog item: it gets a transient GlobalId, targets one replica rather than a cluster, and is re-created from the static list on every boot. Modelling the curated set this way keeps it out of the catalog, so adding or removing a definition needs no builtin migration.

Every replica means every replica of every cluster, user clusters included. Each definition is therefore a dataflow, with its arrangements, on customer compute, charged to that customer’s cluster, and the cost scales with CURATED. coord::introspection already accepts this for its subscribes.

install_metric_sinks installs every definition on a newly created replica (bootstrap_metric_sinks covers the replicas already present at startup), and drop_metric_sinks drops them before a replica is dropped. This mirrors crate::coord::introspection, which installs introspection subscribes on the same triggers.

Structs§

CuratedMetricSink 🔒
A curated metric sink: SQL producing the canonical metric-sink columns, plus the name it is known by in logs.
InstalledMetricSink 🔒
A CuratedMetricSink installed on one replica.
PlannedMetricSink 🔒
A CuratedMetricSink planned once and shared across the replicas it installs on. See Coordinator::plan_metric_sink.

Constants§

CURATED 🔒
The curated metric sinks, installed on every replica.

Functions§

ensure_reads_only_logs 🔒
Enforces the introspection-only contract from CuratedMetricSink::source_sql: every relation the definition reads, walking views transitively, must be a log collection.
metric_sinks_on_replica 🔒
The registry entries installed on replica_id, as (name, cluster, sink) in key order.