Materialized views for cumulative metrics (counter increase/rate, histograms)

Đang mở
#3,483 0 bình luận 0 reaction 0 người được giao Xem trên GitHub

Maintainer thường phản hồi trong vòng 1 ngày

Chưa có ai nhận issue này.

Đánh giá

Độ khó
5/5
Thời gian dự kiến
Hơn một tuần
Mức phù hợp với người mới
35/100
Loại issue
Tính năng
Độ rõ ràng
Khá rõ ràng
Mức độ hoạt động
Sôi nổi
Công nghệ
clickhouse, typescript
Lĩnh vực
databases, observability

Hướng nghiên cứu

Start with the existing gauge materialized view work in #3482 and the histogram handling in core/histogram.ts. Trace how cumulative Sum and histogram series compute per-series deltas before aggregation, then assess how a refreshable materialized view could preserve reset handling and histogram bounds. Done means defining and implementing a supported rollup shape for counters and histograms, with corresponding query and alert behavior.

Do mô hình lập chỉ mục viết ra từ nội dung của issue.

Mô tả

external

What are you trying to do?

Make counter-rate and histogram-quantile charts fast over long ranges, for example increase of an Istio request counter grouped by response code over 24 h. On our deployment (@hyperdx/app 2.42.0, about 4.7 B metric rows per day) that panel takes 6–7 s and reads 52 GiB. Most of the cost is the per-series step: the chart keys each series on cityHash64(ScopeAttributes, ResourceAttributes, Attributes) and computes deltas with lagInFrame over it, so it reads both full Maps whatever the filter. Materialized columns can't help.

What would you like to see?

Materialized view support for cumulative metrics: Sum (counters) and histograms. It's related to #3482 (gauges), but it needs a different shape, because today the delta is computed per series before aggregation:

  • Sum: IF(AggregationTemporality = 1, Value, greatest(Value - lagInFrame(Value) OVER (PARTITION BY AttributesHash ORDER BY TimeUnix), 0))
  • Histogram: per-series, per-bounds deltas of Count / BucketCounts (core/histogram.ts)

So a rollup can't just aggregate Value. One shape that works for us: a view (likely a refreshable MV) that stores, per time bucket and per group, the sum of per-series increases. For histograms, it would store summed per-bucket count deltas with the same ExplicitBounds. HyperDX would read increase / rate from that column as a plain sum per bucket (rate = sum / bucket seconds), and derive quantiles from the summed bucket counts. We'd like your view on:

  • how such a view should be declared on the source: a "pre-computed delta" column type next to the aggFn mappings;
  • reset handling: the rollup would do the same greatest(..., 0) / reset logic once, at write time;
  • whether refreshable MVs (REFRESH EVERY 1 MINUTE) are acceptable as the producer, since an incremental MV can't see the previous point of a series.

Alternatives you've considered

Raw-SQL tiles over our own counter-rate rollup. It works (milliseconds instead of seconds), but each panel is hand-written SQL, and alerts need the SQL path.

Anything else?

Happy to test a branch.

Ngôn ngữ chính
TypeScript
Star
10.1k
Fork
527
Merge trung bình
1 ngày 20 giờ
Pull request đã merge (30 ngày)
186

Chuẩn bị môi trường

Bắt đầu từ đâu

  1. Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
  2. Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
  3. Fork repository và làm thay đổi trên một nhánh.
  4. Mở pull request có tham chiếu số hiệu của issue.

Issue khác của ClickHouse/ClickStack

Tất cả issue của ClickHouse/ClickStack

Issue tương tự

Thêm issue về TypeScript

Nhận issue mới trong hộp thư của bạn

Bản tóm tắt ngắn những issue GitHub phù hợp với người mới.