---
title: "Monitor SLAs and scale ClickHouse Cloud with clickhousectl and agents"
description: "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."
url: "https://swe.quest/articles/monitor-slas-and-scale-clickhouse-cloud-with-clickhousectl-and-agents-941d1a23a934edc8"
canonical: "https://clickhouse.com/blog/monitor-and-scale-clickhouse-cloud-with-clickhousectl"
source: "ClickHouse"
published: "2026-06-05"
difficulty: "medium"
kind: "How-to"
reading_minutes: 7
tags: ["analytics","sre","capacity-planning","ai-agents","observability"]
---

# Monitor SLAs and scale ClickHouse Cloud with clickhousectl and agents

A post on [ClickHouse](https://swe.quest/sources/clickhouse.md), published 2026-06-05, 7 min read, How-to. Original: [https://clickhouse.com/blog/monitor-and-scale-clickhouse-cloud-with-clickhousectl](https://clickhouse.com/blog/monitor-and-scale-clickhouse-cloud-with-clickhousectl)

## Summary

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.

Written by swe.quest, not by the author.

**Difficulty:** Medium: assumes a working developer; shows how it is built or done

## Topics

- [Analytics & OLAP](https://swe.quest/tags/analytics.md) (Data & databases)
- [SRE](https://swe.quest/tags/sre.md) (Reliability & operations)
- [Capacity planning](https://swe.quest/tags/capacity-planning.md) (Reliability & operations)
- [AI agents](https://swe.quest/tags/ai-agents.md) (AI & ML)
- [Observability](https://swe.quest/tags/observability.md) (Reliability & operations)

## Prerequisites

- ClickHouse SQL basics ([easy posts on Analytics & OLAP](https://swe.quest/tags/analytics.md?difficulty=easy))
- latency percentiles ([easy posts on Performance engineering](https://swe.quest/tags/performance.md?difficulty=easy))
- Prometheus metrics ([easy posts on Observability](https://swe.quest/tags/observability.md?difficulty=easy))

## Keywords

ClickHouse Cloud, clickhousectl, system.query\_log, Prometheus, Claude Code

## Related posts

- [How Modal uses ClickHouse to power real-time observability for AI workloads](https://swe.quest/articles/how-modal-uses-clickhouse-to-power-real-time-observability-for-ai-workloads-a1efae326a0a9591.md): ClickHouse · 2025-11-05 · Medium · 6 min read · Analytics & OLAP, Observability, Stream processing, Scaling
  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.
- [Essential Monitoring Queries - part 2 - SELECT Queries](https://swe.quest/articles/essential-monitoring-queries-part-2-select-queries-f0cc886a137efe02.md): ClickHouse · 2023-01-03 · Medium · 10 min read · Analytics & OLAP, Observability, Performance engineering, SQL
  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.
- [Our New Observability Platform for 100B Logs](https://swe.quest/articles/our-new-observability-platform-for-100b-logs-ffdc8340b285c59b.md): Railway · 2023-09-29 · Medium · 7 min read · Observability, Analytics & OLAP, Replication, Scaling
  Railway 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.
- [Goodbye limitations, hello data: How Qonto is rethinking observability with ClickHouse Cloud](https://swe.quest/articles/goodbye-limitations-hello-data-how-qonto-is-rethinking-observability-with-756d9cefa803d826.md): ClickHouse · 2026-05-01 · Easy · 8 min read · Observability, Analytics & OLAP, AI agents, Cost optimization
  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.
- [How LY Corporation uses ClickHouse to observe one of the largest Kafka deployments on earth](https://swe.quest/articles/how-ly-corporation-uses-clickhouse-to-observe-one-of-the-largest-kafka-4673da61e0f144c7.md): ClickHouse · 2026-02-09 · Medium · 6 min read · Observability, Queues & messaging, Analytics & OLAP, Debugging
  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.

Browse: [Latest posts](https://swe.quest/index.md) · [Topics](https://swe.quest/tags.md) · [Sources](https://swe.quest/sources.md) · [Topic map](https://swe.quest/map.md) · [Site guide (llms.txt)](https://swe.quest/llms.txt)
