Datadog + Grafana Alerting That Actually Reduces MTTR
Design database alerting that shortens incidents: symptom-based alerts, SLO burn rates, anomaly monitors, runbook links and the dashboards on-call engineers need.
More alerts do not mean more reliability. After rebuilding observability on Datadog and Grafana with anomaly-based alerting across database tiers, mean time to resolution dropped from roughly 45 to 31 minutes. The gains came from fewer, better alerts and faster diagnosis, not from more dashboards.
1. Page on symptoms, ticket on causes
A page should mean "users are being hurt right now". High CPU alone is a cause and may be harmless. Elevated error rate or latency against an SLO is a symptom and always matters. Keep a clear rule:
- Page: SLO burn, writes failing, replication broken, disk about to fill.
- Ticket: slow-growing issues like bloat, unused indexes, certificates expiring in 30 days.
- Dashboard only: everything else.
2. Alert on SLO burn rate
With a 99.9% monthly SLO your error budget is 0.1%. A burn rate of 1 spends the budget exactly over the month. Multi-window rules catch both fast and slow burns while staying quiet during blips:
- Page when burn rate > 14.4 over 1 hour and over 5 minutes (about 2% of the monthly budget gone in an hour).
- Page when burn rate > 6 over 6 hours and over 30 minutes (about 5% gone).
- Ticket for slower burns (for example > 1 over 3 days).
Use the SLO calculator to see what your target allows in minutes.
3. Database signals worth alerting on
- Latency and errors from the application's point of view.
- Replication lag and replica health.
- Connection saturation: connections in use vs the maximum.
- Disk and WAL growth, including inactive replication slots.
- Long-running and idle-in-transaction sessions, lock waits and deadlocks.
- Transaction ID age approaching wraparound territory.
Metric names depend on your integration and exporter versions, so confirm them in your own Datadog or Prometheus before copying any query.
4. Use anomaly detection where thresholds fail
Traffic with daily and weekly seasonality makes static thresholds either noisy or blind. Anomaly monitors compare a metric with its own history, which works well for query rate, connection counts and latency. Pair them with a minimum-impact guard (for example, only when traffic is above a floor) to avoid 3 a.m. pages over tiny numbers.
5. Every alert links to a runbook
The fastest way to cut MTTR is to remove thinking time. Each alert should say what it means, how to confirm it, the first three diagnostic steps and who owns it. Put the runbook URL in the alert body and the top graph in the message.
Title: [P1] Replication lag > 60s on {{host.name}}
Impact: Read replicas serving stale data; failover RPO at risk
Runbook: https://wiki.example.com/runbooks/pg-replication-lag
Dash: https://grafana.example.com/d/pg-overview?var-host={{host.name}}
6. Three dashboard layers
- Fleet overview: one row per database, red/green on SLO and saturation.
- Database detail: golden signals, locks, replication, top queries.
- Deep dive: wait events, vacuum, I/O, per-table stats.
On-call should reach the right layer in two clicks from the alert.
7. Measure MTTR honestly
Define the clock: from alert fired (or customer impact start) to service restored. Track it per incident, review outliers in post-mortems, and watch the trend. Also track alert quality: percentage of pages that needed action. If it is below 70% or so, you are training people to ignore the pager.
Checklist
- Page only on symptoms; ticket the rest.
- Multi-window SLO burn-rate alerts.
- Anomaly monitors for seasonal metrics.
- Runbook and dashboard link in every alert.
- Review alert quality monthly; delete noisy rules.
Enjoyed this?
I write about PostgreSQL, AWS and database reliability. Have a question or a similar problem to solve?