Metrics Monitoring & Alerting
Requirements: collect metrics (CPU, latency, business counters) from 100k hosts, store with downsampling, dashboards, alert rules with low latency.
agents (push) / scrapers (pull) -> Kafka -> stream processors (aggregate, downsample)
|
v
time-series DB (e.g. Prometheus/M3/InfluxDB): series = metric + labels
| query API | rule evaluator (every 15 s)
v v
dashboards (Grafana) alert manager -> dedupe/group -> PagerDuty, Slack, email
Deep dives
- Data model: series id =
name{label=value,…}; points(timestamp, value); beware cardinality explosions (user_id as a label!). - Storage: append-only, compressed (delta-of-delta timestamps, XOR floats — Gorilla) ~1.4 bytes/point; time-partitioned blocks; retention tiers (raw 7 d, 1-min rollups 30 d, 1-h rollups 1 y).
- Push vs pull: pull (Prometheus) knows which targets are down; push works through firewalls/short-lived jobs.
- Alerting: avoid flapping (
for: 5m), group and deduplicate, route by severity; alert on SLO burn rates.