Materialized view support for Metric sources (gauges)

Abierto
#3,482 11 comentarios 0 reacciones 0 asignados Ver en GitHub

Los mantenedores suelen responder en 1 día

Nadie ha tomado este issue todavía.

Evaluación

Dificultad
5/5
Tiempo estimado
Más de una semana
Aptitud para principiantes
35/100
Tipo de issue
Nueva funcionalidad
Claridad
Bastante claro
Estado de actividad
Activo
Stack tecnológico
clickhouse, typescript

Línea de trabajo

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.

Escrito por el modelo de indexación a partir del texto del issue.

Descripción

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.

Lenguaje dominante
TypeScript
Estrellas
10.1k
Forks
527
Merge medio
1 d 20 h
PR fusionados (30 d)
186

Preparar el entorno

Primeros pasos

  1. Lee el issue completo y luego la guía de contribución del proyecto.
  2. Comenta en el issue que vas a ocuparte — evita que dos personas hagan lo mismo.
  3. Haz un fork del repositorio y trabaja en una rama.
  4. Abre un pull request que haga referencia al número del issue.

Más de ClickHouse/ClickStack

Todos los issues de ClickHouse/ClickStack

Issues similares

Más issues de TypeScript

Recibe los nuevos issues en tu correo

Un resumen breve de issues de GitHub para principiantes.