catalog: builtin metric sinks types, catalog item, and lowering (SQL-554)#37841
Open
mtabebe wants to merge 1 commit into
Open
catalog: builtin metric sinks types, catalog item, and lowering (SQL-554)#37841mtabebe wants to merge 1 commit into
mtabebe wants to merge 1 commit into
Conversation
mtabebe
force-pushed
the
ma/prom-metrics/sql-554
branch
2 times, most recently
from
July 23, 2026 21:09
1a21275 to
548d41a
Compare
mtabebe
force-pushed
the
ma/prom-metrics/sql-554
branch
from
July 24, 2026 13:19
548d41a to
68d2b95
Compare
…554) Problem: The Prometheus cluster metrics feature needs the authoring type, catalog representation, and lowering for builtin metric sinks. Nothing gets installed and there's no runtime behavior change yet. The abstraction is the generic, backend-agnostic MetricSink, not a Prometheus-specific one. Solution: - Add the `BuiltinMetricSink` authoring type, along with `BuiltinMetricSinkValue`, `MetricSinkKind`, a `Builtin::MetricSink` variant. - `builtin_metric_sink_view_sql` projects a sink's query into the canonical MetricSink row shape (`metric_name`, `metric_type`, `labels`, `value`, `help`), `UNION ALL`-ed across the value columns. - Each sink materializes a companion `BuiltinView` (the canonical shape, built at enumeration time) plus a thin `CatalogItem::MetricSink` that points at it. - Add `CatalogItemType::MetricSink` (rendered `metric-sink`) and the `CatalogItem::MetricSink`, `MetricSink`, and `MetricSinkValue` structs, then wire them through every exhaustive match - Boot construction builds the item directly (`create_sql: None`) - For discoverability, the `mz_metric_sinks_raw` backing table (populated in `builtin_table_updates`) feeds the `mz_internal.mz_metric_sinks` view and `mz_catalog.mz_objects` (as `type = 'metric-sink'`). Note: It's registered before `mz_objects` in the builtin list, since a builtin view can only depend on lower-id builtins. - Register the first concrete sink, `mz_metric_dataflow_errors`, with companion view `mz_metric_dataflow_errors_shaped`. No dataflow is installed here. Testing: - Unit tests for the lowering - catalog-protos snapshot consistency tests Co-Authored-By: Moritz Hoffmann <mh@materialize.com>
mtabebe
force-pushed
the
ma/prom-metrics/sql-554
branch
from
July 24, 2026 17:28
68d2b95 to
59294b3
Compare
mtabebe
marked this pull request as ready for review
July 24, 2026 18:16
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem:
The Prometheus cluster metrics feature needs the authoring type, catalog representation, and lowering for builtin metric sinks.
Nothing gets installed and there's no runtime behavior change yet.
The abstraction is the generic, backend-agnostic MetricSink, not a Prometheus-specific one.
Solution:
BuiltinMetricSinkauthoring type, along withBuiltinMetricSinkValue,MetricSinkKind, aBuiltin::MetricSinkvariant.builtin_metric_sink_view_sqlprojects a sink's query into the canonical MetricSink row shape (metric_name,metric_type,labels,value,help),UNION ALL-ed across the value columns.BuiltinView(the canonical shape, built at enumeration time) plus a thinCatalogItem::MetricSinkthat points at it.CatalogItemType::MetricSink(renderedmetric-sink) and theCatalogItem::MetricSink,MetricSink, andMetricSinkValuestructs, then wire them through every exhaustive matchcreate_sql: None)mz_metric_sinks_rawbacking table (populated inbuiltin_table_updates) feeds themz_internal.mz_metric_sinksview andmz_catalog.mz_objects(astype = 'metric-sink'). Note: It's registered beforemz_objectsin the builtin list, since a builtin view can only depend on lower-id builtins.mz_metric_dataflow_errors, with companion viewmz_metric_dataflow_errors_shaped. No dataflow is installed here.Testing:
Note to reviewers:
The most important things to review are:
There are some mechanical changes (exhaustive-match arms for the new CatalogItem::MetricSink variant across sql/ and adapter/coord/, plus new OIDs) or generated changes (objects_v91.rs, the encoding snapshot, and the regenerated SLT/testdrive golden files)