This episode takes observability to the level of service promises: defining SLOs for latency, availability, and throughput, monitoring the health of each shard, and building alerting that's right for replication lag, primary failure, and query errors.

In episode 7 you learned to see the cluster; episode 21 raises that to the level of promises: how fast, how reliable, and how much capacity your service has — measured. SLOs (Service Level Objectives) turn observability from "we monitor" into "we commit and measure". Without SLOs, performance discussions are always subjective.
Episode 21 roadmap: defining SLOs, monitoring shard health, query metrics, then building effective alerting that doesn't make noise.
An SLO is a measurable target for service health. The three most relevant dimensions for Vitess:
latency_slo:
target_ms: 50
threshold_percentile: 95
availability_slo:
target_percent: 99.95
throughput_slo:
qps: 50000
replication_lag_slo:
max_seconds: 30latency_slo.target_ms: 50 means the target: 95% of queries finish within 50ms. SLOs must be realistic and agreed with business stakeholders — not just numbers engineers hope for.
Info
Start with three simple SLOs: P95 latency, availability, and replication lag. Add new SLOs only when you can genuinely measure them well. An unmeasured SLO is just a piece of writing.
At large scale, operator attention shifts from per-tablet to per-shard. Every shard has health that must be monitored: primary status, replication lag, QPS, and query errors.
vtctlclient ListShardHealthvtctlclient ListShardHealth displays the status of each shard. For automated dashboards, parse the JSON output and feed it to Prometheus. An unhealthy shard must be clearly visible — because one problematic shard can drain traffic from an entire keyspace.
Shard metrics monitored routinely:
Seconds_Behind_Source — replication lag (from SHOW REPLICA STATUS).Query metrics reveal patterns: which queries are slow, which shard is busiest, and which query types dominate. At VTGate, query metrics are grouped by keyspace, shard, and table. The keys to finding bottlenecks:
curl -s http://localhost:15001/metrics | grep -E 'vtgate_query_(duration|error|rows)' | headcurl -s ... vtgate_query shows VTGate query metrics — the foundation for building latency and error rate dashboards.
Alerting is the bridge from metrics to action. The main rule: alerts must be actionable and quiet. Too many alerts make operators ignore them. Several important alerts for Vitess:
Example Prometheus alert for replication lag:
groups:
- name: vitess
rules:
- alert: HighReplicationLag
expr: mysql_replication_seconds_behind_source > 30
for: 5m
labels:
severity: warning
annotations:
summary: "Replication lag melebihi 30 detik"The mysql_replication_seconds_behind_source > 30 rule fires an alert if lag exceeds 30 seconds for 5 consecutive minutes — the for: 5m filter prevents alerts from harmless temporary spikes.
Warning
Every new alert must answer three questions: what should the person receiving it do, how quickly, and has this alert ever led to real action. An alert that's never used is noise that buries important alerts.
In this episode 21 you brought observability to the level of promises: defining SLOs for latency, availability, and throughput, monitoring per-shard health, digging into query metrics to find bottlenecks, and building effective, quiet alerting.
Key takeaways:
for filter prevents noise.In the final episode, episode 22, we summarize everything: production hardening and best practices — a security checklist, scaling and failover readiness, runbook documentation, and safe Vitess and MySQL upgrades. See you there!