Skip to content

In development. Expect rough edges and changes. The source code is not public yet.

ClickHouse 9 min read Deep dive mediumAdept

Using Event Patterns in ClickStack to accelerate observability analysis

ClickStack clusters logs and traces into event patterns at query time using the Drain3 template-mining algorithm, which runs in the browser via Pyodide (Python compiled to WebAssembly). Clustering at ingest was rejected because the overhead is too high at gigabytes-per-second ingestion rates. Instead, each search result set is sampled down to about 10,000 evenly distributed events with a cityHash64-modulo sampling query that avoids ORDER BY rand(), returning clusters within seconds. The recommended workflow is to filter broadly by service or severity, treat rare patterns as leads, then pivot to raw search or traces. Future work could run Drain3 as a ClickHouse UDF and compile the learned templates into ingest-time extraction rules for better compression.

Related posts

  • Improve logs compression with log clustering

    ClickHouse mediumAdept

    Drain3 log template mining, run inside ClickHouse as a Python executable UDF, can turn unstructured application logs into structured columnar data. Templates mined from a sample of each service's logs become regex patterns in a materialized view, which extracts variable fields into a Map column keyed by template number at ingest time. Two templates covered 99.99% of one service's logs, and unmatched lines are kept raw. The approach reached nearly 50x compression while keeping logs queryable and fully reconstructable, though evaluating every pattern against every log line needs optimization to scale.

  • How Canva achieved 10x faster search and 70% lower costs with ClickHouse

    ClickHouse mediumAdept

    Canva moved tracing and logging (about 3 million spans and 3 million logs per second) onto a self-managed ClickHouse cluster of 5 shards × 3 replicas on Kubernetes. It reached a 14x compression ratio, cut costs by about 70%, and brought P90 trace search down from 30s to 2.5s. The ingestion gains came from batching roughly 200k spans per insert in OpenTelemetry collectors and writing straight to local tables. Search speed came from a sorting key aligned with Jaeger's filters, daily partitions, a materialized-view lookup table keyed by trace ID, and a client-side sliding search window. Logs flow through Kinesis and Lambda using tuned async inserts, with ngram Bloom filters on flattened log strings for free-text search and a custom DSL query gateway.

  • How we made ClickStack 5x faster for ClickHouse observability

    ClickHouse hardMaster

    ClickStack's OpenTelemetry logs schema, inherited from the ClickHouse exporter for the OTel Collector, was reworked through a benchmark-driven process. The changes combined time-bucketed primary key redesign, text indexes, query rewrites, materialized views and newer ClickHouse features, cutting representative observability query latency by more than 5×. Every schema iteration was validated with the ClickCannon tool and ephemeral ClickHouse Cloud instances at 640 MiB/s ingest on three 24-core replicas. Each change was judged against ingestion throughput, CPU, memory, part counts and the full query workload, so a gain on one query pattern could not hide regressions elsewhere.

  • What's new in ClickStack - May 2026

    ClickHouse easyNovice

    ClickStack's May 2026 update focuses on making dashboards useful during investigations. It adds configurable table row actions that link to templated searches or other dashboards, scoped multi-source filters, threshold-colored number tiles, and a service map with p50/p95/p99 latency, throughput, Lucene/SQL filtering and a focus mode. Other additions include experimental PromQL support built on the ClickHouse TimeSeries Engine, a Browser RUM dashboard template, a split-pane trace view, configurable event-pattern columns, and new MCP tools for agents. The direct-read attribute search optimization, measured at 1.4x–10x faster, is now on by default because it works with ALIAS columns and no longer needs extra storage.

  • ClickStack: A (half) year in review

    ClickHouse easyNovice

    ClickStack, the ClickHouse-based observability stack built on HyperDX and OpenTelemetry, shipped a run of features between its May launch and December. These include native JSON attribute storage, a ClickHouse Cloud-hosted UI, dashboard import/export and custom collector configs, and time-window chunked search that fetches recent data first and stops early. Later months added threshold alerting on isolated compute pools, configurable Event Deltas, and Service Maps in beta. December's integrated materialized views let the query layer use EXPLAIN ESTIMATE to pick whichever registered incremental view scans the fewest granules, accelerating searches, charts and dashboards automatically.

The quest for software engineering knowledge.

Look:
Layout: