Materialized view support for Metric sources (gauges)

Offen
#3,482 11 Kommentare 0 Reaktionen 0 zugewiesene Personen Auf GitHub ansehen

Maintainer antworten meist innerhalb von 1 Tag

Dieses Issue hat noch niemand übernommen.

Bewertung

Schwierigkeit
5/5
Geschätzter Aufwand
Über eine Woche
Anfängerfreundlichkeit
35/100
Issue-Typ
Feature
Klarheit
Größtenteils klar
Aktivitätsstatus
Aktiv
Tech-Stack
clickhouse, typescript

Rechercherichtung

Start with packages/api/src/models/source.ts, where materializedViews is currently defined for log and trace sources, then trace how gauge charts choose query tables and how log attributes map to __otel_materialized_* columns. The issue does not identify the routing or query files, so locate those entry points before estimating the full change. Done means gauge views can be registered and selected when metric name, aggregation, granularity, group-by, and filters fit, with other queries falling back to raw tables.

Vom Indexierungsmodell aus dem Issue-Text verfasst.

Beschreibung

external

What are you trying to do?

Make dashboard metric charts over long ranges fast. Materialized views (#1507) work well for Log and Trace sources: on our deployment (@hyperdx/app 2.42.0), a per-minute log rollup answered 24 h count-by-service charts and the search histogram in 4–16 ms instead of 1.9 s, with exact counts.

Metric sources can't use them. materializedViews is defined only for the log and trace kinds (packages/api/src/models/source.ts), so every metric chart scans the raw otel_metrics_* tables. Metric charts are now the slowest part of our dashboards, at about 4.7 B metric rows per day.

What would you like to see?

Materialized view support for Metric sources, starting with gauges. These are the simple case, because no per-series state is involved:

  • A Metric source can register views for its gauge table: target table, timestamp column, granularity, dimension columns, and aggregated columns (avg / min / max / last_value as -State / SimpleAggregateFunction columns, like log MVs).
  • A gauge chart is routed to a view when the metric name, aggregation, granularity, and group-by / filter attributes fit. Otherwise it falls back, as today.
  • Attribute dimensions: let a view expose Attributes['k'] / ResourceAttributes['k'] as named columns, the way filters are already mapped to __otel_materialized_* columns for logs.

Counters (Sum) and histograms are cumulative and need per-series deltas, so they are filed separately (#3483).

Alternatives you've considered

  • Raw-SQL tiles pointing at our own rollup tables. They work, but every panel has to be rewritten by hand and loses the builder (filters, group-by, alerts).
  • Materialized columns for hot attribute keys. They help filters, but each series is still keyed on cityHash64(ScopeAttributes, ResourceAttributes, Attributes), which reads the full Maps.

Anything else?

Happy to test a branch on our deployment: ClickStack with a self-hosted ClickHouse cluster.

Vorherrschende Sprache
TypeScript
Sterne
10.1k
Forks
527
Ø Merge
1 T. 20 Std.
Gemergte PRs (30 T.)
186

Entwicklungsumgebung

Erste Schritte

  1. Lesen Sie das ganze Issue und danach den Beitragsleitfaden des Projekts.
  2. Schreiben Sie ins Issue, dass Sie es übernehmen — das erspart doppelte Arbeit.
  3. Forken Sie das Repository und arbeiten Sie in einem Branch.
  4. Öffnen Sie einen Pull Request, der die Issue-Nummer nennt.

Mehr aus ClickHouse/ClickStack

Alle Issues in ClickHouse/ClickStack

Ähnliche Issues

Weitere Issues zu TypeScript

Neue Issues direkt in Ihr Postfach

Eine kurze Übersicht über anfängerfreundliche GitHub-Issues.