Lesson 9 of 9 · 27m
Operating Prometheus and Grafana Through Real Incidents
Retention, remote storage, HA tradeoffs, backup realities, and the operational habits that matter when monitoring itself is under stress.
Running Prometheus is easy until you ask production questions: how long is data retained, what happens when the disk fills, how do we survive a node loss, why did queries become slow, and can we trust the monitoring system during the exact incident when everything else is broken. Those are architectural questions, not YAML trivia.
Retention is a budget, not a virtue
prometheus --storage.tsdb.retention.time=30d --storage.tsdb.retention.size=80GB --storage.tsdb.path=/var/lib/prometheusLong retention costs disk, memory, compaction time, and query complexity. Keep high-resolution data long enough to debug incidents and compare deploys; use downsampling or long-term remote storage for months-old trends. A year of 15-second raw data is usually hoarding dressed up as compliance.
Decide what question each retention tier answers. Local Prometheus: operational debugging. Remote store: capacity planning and long-term trend. Logs/traces: forensic detail. Do not force metrics to be all three.
HA is duplication plus deduplication
Two Prometheus servers scraping the same targets provide independent collection, but they create duplicate series if remote storage is shared. Systems such as Thanos, Mimir, or Cortex handle deduplication and global query, at the cost of operating a distributed system.
The wrong lesson is "therefore run one giant Prometheus." The better lesson is "pick the simplest architecture that meets the failure requirement." For many small platforms, two independent regional Prometheus instances plus object-storage backup is more operable than a premature distributed metrics empire.
Monitor the monitors
Essential Prometheus self-signals include:
prometheus_tsdb_head_series
rate(prometheus_tsdb_head_samples_appended_total[5m])
prometheus_target_scrapes_exceeded_sample_limit_total
prometheus_rule_evaluation_failures_total
prometheus_notifications_errors_totalWatch disk usage, WAL corruption events, rule evaluation duration, ingestion rate, head compaction, and remote-write queue depth. If remote write backs up, dashboards may look healthy while long-term storage silently loses data.
Grafana is state too
Grafana stores dashboards, users, alert rules, annotations, and data sources. Back up its database. Provision data sources and dashboards from version control where possible. During an outage, nobody should discover that the only copy of the critical dashboard lived in a Grafana SQLite file on a terminated instance.
Example provisioning snippet:
apiVersion: 1
datasources:
- name: Prometheus
type: prometheus
access: proxy
url: http://prometheus:9090
isDefault: trueIncident behavior changes the data
During incidents, traffic patterns shift, targets disappear, retries multiply, and scrapes can fail. Interpretation matters:
- A falling request rate may mean recovery or complete upstream rejection.
- Error ratios can fall because successful requests disappeared faster than errors.
- Per-instance averages can hide one poisoned node if aggregation is careless.
- Deploy markers and annotations are invaluable when correlating changes.
Add annotations for deploys, migrations, feature flags, and infrastructure events. Human memory is not a durable correlation engine.
Practice the boring recovery paths
Restore testing matters more than backup existence. Can you start Prometheus on yesterday's TSDB snapshot? Can Grafana be rebuilt from provisioning plus database restore? Do you know which component owns notification credentials?
Run game days where Prometheus is slow or unavailable. Teams discover quickly whether runbooks depend on dashboards that are themselves down.
Field notes
- Never let the monitoring node share fate with the only systems it monitors. At minimum, separate failure domains for critical paging.
- Alertmanager silence and inhibition rules are operational interfaces; review them like firewall rules.
- Remote storage does not remove local cardinality problems. It exports them.
- Write down which metrics are contract-critical. In a migration, those must be validated before cosmetic dashboard parity.
Was this lesson helpful?