Skip to content

compute: add MetricSink sink operator + connection type (SQL-553)#37813

Open
mtabebe wants to merge 1 commit into
MaterializeInc:mainfrom
mtabebe:ma/prom-metrics/sql-553
Open

compute: add MetricSink sink operator + connection type (SQL-553)#37813
mtabebe wants to merge 1 commit into
MaterializeInc:mainfrom
mtabebe:ma/prom-metrics/sql-553

Conversation

@mtabebe

@mtabebe mtabebe commented Jul 22, 2026

Copy link
Copy Markdown
Contributor

Problem:

The Prometheus cluster metrics feature needs a compute-side sink that folds a dataflow's output rows into the process-local MetricsRegistry, so Prometheus can scrape them from clusterd's existing /metrics endpoint.

Solution:

Add the MetricSink operator and its ComputeSinkConnection::MetricSink variant. A dataflow whose terminal sink is a MetricSink folds its input rows into the process-local MetricsRegistry, where Prometheus scrapes them from the existing /metrics endpoint. This adds no authoring type, no catalog changes, and no user DDL.

  • compute-types: ComputeSinkConnection::MetricSink variant + MetricSinkConnection (payload-free) + name().
  • compute: metric_sink operator (frontier-gated SinkState fold + SinkCollector)
  • adapter/optimize: shape_metric_sink_source + METRIC_NAME_PATTERN, the metric_kind/name_valid column contract the operator reads.
  • compute-client: specialize_command_for_replica arm (no storage metadata).

The six per-sink health gauges are mz_metric_sink_{frontier_ms,errors, skipped,conflicts,collisions,null_values}, each carrying a sink="" const label.

Testing:

  • New unit tests

Co-authored by: Moritz Hoffmann antiguru@gmail.com

@mtabebe
mtabebe force-pushed the ma/prom-metrics/sql-553 branch 2 times, most recently from c911cea to d5f1f36 Compare July 22, 2026 19:57
@mtabebe
mtabebe requested review from SangJunBak and antiguru July 22, 2026 20:28
@mtabebe
mtabebe marked this pull request as ready for review July 22, 2026 20:28
@mtabebe
mtabebe requested review from a team as code owners July 22, 2026 20:28
@mtabebe
mtabebe force-pushed the ma/prom-metrics/sql-553 branch from d5f1f36 to 85d44b9 Compare July 22, 2026 20:41
Problem:

The Prometheus cluster metrics feature needs a compute-side sink that folds a
dataflow's output rows into the process-local MetricsRegistry, so Prometheus can
scrape them from clusterd's existing /metrics endpoint.

Solution:

Add the MetricSink operator and its ComputeSinkConnection::MetricSink variant. A
dataflow whose terminal sink is a MetricSink folds its input rows into the
process-local MetricsRegistry, where Prometheus scrapes them from the existing
/metrics endpoint. This adds no authoring type, no catalog changes, and no user
DDL.

- compute-types: ComputeSinkConnection::MetricSink variant + MetricSinkConnection
  (payload-free) + name().
- compute: metric_sink operator (frontier-gated SinkState fold + SinkCollector)
- adapter/optimize: shape_metric_sink_source + METRIC_NAME_PATTERN, the
  metric_kind/name_valid column contract the operator reads.
- compute-client: specialize_command_for_replica arm (no storage metadata).

The six per-sink health gauges are mz_metric_sink_{frontier_ms,errors,
skipped,conflicts,collisions,null_values}, each carrying a sink="<id>" const
label.

Testing:

- New unit tests

Co-authored-by: Moritz Hoffmann <antiguru@gmail.com>
@mtabebe
mtabebe force-pushed the ma/prom-metrics/sql-553 branch from 85d44b9 to 747f6d5 Compare July 22, 2026 20:47
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant