Prometheus metrics backend

DesignHard45 minUber and Google style

Your task

Design a Prometheus-compatible metrics ingestion and query backend for a fleet of 50,000 hosts emitting 20M active time series, scraped every 15s. Steady-state ingest is ~1.3M samples/sec with bursts to 4M during deploys. Queries are mostly dashboard range reads over the last 6h (p99 < 500ms) plus a long tail of alerting rule evaluations every 30s. Raw resolution must be kept 15 days, 5-minute rollups 13 months. Walk the write path, the storage layout, and how you keep query latency bounded as cardinality grows.

It covers

  • Cardinality
  • Ingest
  • Downsampling