call(back)

Design a Distributed Metrics System

Design a metrics system for a large fleet: hosts and services emit counters, gauges and histograms with labels; engineers query them for dashboards and alerts.

Cover collection, the ingest tier, the storage layout and how data ages, the query path, and the two decisions that shape such systems: push versus pull collection, and how to keep label cardinality from destroying the store.

Hints

Hint 1

Agents aggregate locally and send batches to an ingest tier that validates, applies limits and writes to a time-series store partitioned by metric and time.

Hint 2

Downsample old data — raw for days, one-minute rollups for months — and query the resolution the range asks for.

Hint 3

Cardinality is the hidden cost: a label with unbounded values (user id, request id) creates a series per value. Enforce per-metric series limits at ingest.

Asked at