Monitor SLAs and scale ClickHouse Cloud with clickhousectl and agents
Tagging frontend queries with `log_comment` lets you compute a specific latency SLA, such as p99 under 200 ms, directly from `system.query_log` across replicas. You can then diagnose a breach by comparing query volume against latency and checking Prometheus CPU, memory and concurrency metrics. High concurrency points to adding replicas, while memory pressure points to bigger replicas. `clickhousectl` handles the scaling, either from a simple cron that scales out on breach or by handing the breach to a Claude agent prompted to investigate and apply exactly one scaling action. Every action is recorded in the activity log for auditing.
Related posts
- How Modal uses ClickHouse to power real-time observability for AI workloads
ClickHouse mediumAdept
Modal powers three customer-facing observability dashboards (function scaling, per-call timeline, latency percentiles) from a single ClickHouse Cloud table ingesting 1–2 million events per minute and holding ~500 billion logs. Function-call lifecycle events (queued, executing, finished) stream through Kafka and ClickPipes into a ReplacingMergeTree table keyed on function_id, function_call_id and event_at, with ULIDs enabling primary-key range queries. Queries reconstruct call state with GROUP BY function_call_id and argMaxIf for the latest status, and compute P50/P90/P99 queue and execution latency directly with quantile functions. The team reached this scale without indexes, projections or materialized views, and is only now starting latency optimizations.
- Essential Monitoring Queries - part 2 - SELECT Queries
ClickHouse mediumAdept
A set of SQL queries against ClickHouse system tables (system.parts, system.query_log, system.processes, system.stack_trace) for monitoring and troubleshooting SELECT workloads: cluster size overview, most expensive queries, ProfileEvents diffs between two query versions, hourly duration trends, per-client query counts, and diagnosing TOO_MANY_SIMULTANEOUS_QUERIES. Setting send_logs_level = 'trace' in clickhouse-client exposes per-query execution logs; in the UK price paid example, adding a projection ordered by town and price cut marks read from 3401 to 266 and latency from 1.2s to 0.028s. Queries use clusterAllReplicas for ClickHouse Cloud and can be adapted for self-managed clusters.
- Our New Observability Platform for 100B Logs
Railway mediumAdeptRailway rebuilt its logging backend on ClickHouse to power Log Explorer, handling about 1 billion new logs per day, 100 billion stored logs and 60 queries/sec at roughly 50ms average latency on a 2-shard/2-replica cluster. The previous system (local filesystem plus GCS, filtering in a single Go process) couldn't do cross-service search, fast far-back queries, horizontal scaling or aggregates. ClickHouse compressed 28TB of tagged logs to 5TB, and the team rolled it out within a week by dual-writing via Vector and translating their filter DSL to SQL. The main production surprise was asynchronous replication omitting recent logs, which an HAProxy primary-routing attempt didn't fix but the insert_distributed_sync setting did.
- Goodbye limitations, hello data: How Qonto is rethinking observability with ClickHouse Cloud
ClickHouse easyNovice
Qonto, a European digital bank, moved trace storage from Grafana Tempo to ClickHouse Cloud, extending query windows from 2-3 hours to two weeks without sampling and adopting a wide-events model instead of the logs/metrics/traces pillars. High-cardinality span and resource attributes compress from 231 TB to 376 GB, saving an estimated $70K a year in S3 costs, so engineers are now encouraged to add attributes freely. Telemetry flows through OpenTelemetry collectors over AWS PrivateLink into ClickHouse, with Grafana for dashboards. An AI incident companion built on the ClickHouse MCP server, behind a roughly 30-line read-only Python layer, lets non-experts investigate incidents and scope affected customers in plain English.
- How LY Corporation uses ClickHouse to observe one of the largest Kafka deployments on earth
ClickHouse mediumAdept
LY Corporation (LINE + Yahoo! Japan) runs a Kafka platform of 200+ brokers serving 25,000+ clients and handling 31M messages/sec at peak, over 1 trillion messages and 2.6 PB of I/O per day. Its observability stack spans end-to-end latency probes, Async Profiler, eBPF and kernel delay accounting, and disk SMART data. The key layer is a Kafka API request log pipeline: requests are intercepted, serialized with Protocol Buffers, sent through an internal Kafka cluster and batch-ingested into ClickHouse at 7M rows/sec, about 4.1 trillion rows on 24 nodes. SQL queries over these logs confirmed a race condition between Produce and ListOffsets that caused non-monotonic offsets and halted replication, which led to an upstream patch.