Materialized view support for Metric sources (gauges)

Aperta
#3,482 11 commenti 0 reazioni 0 assegnatari Vedi su GitHub

I maintainer di solito rispondono entro 1 giorno

Nessuno ha ancora preso questa issue.

Valutazione

Difficoltà
5/5
Tempo stimato
Più di una settimana
Idoneità per principianti
35/100
Tipo di issue
Funzionalità
Chiarezza
Abbastanza chiara
Stato di attività
Attiva
Stack tecnologico
clickhouse, typescript

Direzione di ricerca

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.

Scritto dal modello di indicizzazione a partire dal testo della issue.

Descrizione

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.

Lingua principale
TypeScript
Stelle
10.1k
Fork
527
Merge medio
1g 20h
PR unite (30g)
186

Preparare l'ambiente

Come iniziare

  1. Leggi tutta la issue e poi la guida ai contributi del progetto.
  2. Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
  3. Fai un fork del repository e lavora su un branch.
  4. Apri una pull request che faccia riferimento al numero della issue.

Altre issue di ClickHouse/ClickStack

Tutte le issue di ClickHouse/ClickStack

Issue simili

Altre issue su TypeScript

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.