Skip to content

Specialised stores · 1 of 4

Time-series store: the label explosion

Step 1 · The pattern

Numbers over time, by label

Services send samples like http_requests_total{route, status} every few seconds. The store keeps one series per combination of labels and appends samples to it. A handful of routes times a handful of statuses is a few dozen series. (All numbers are illustrative.)

  • a sample
  • stored

In short

Time-series store: the label explosion: how it works and how it breaks

A time-series store (Prometheus, for example) is built for numbers over time: request rates, latencies, queue depths. It keeps one series per unique combination of a metric's labels, and recent series live in memory. Labels with a few values (status code, region, endpoint) are cheap. A label with unbounded values is not: a user ID, a request ID, an email address, or even a pod name that changes every deploy creates a new series for every new value, and memory grows with them. The store does not slow down gracefully; it is killed for running out of memory, often during the incident you needed it for, because incidents bring new values. Keep labels to small, known sets; put per-user detail in logs or traces, not metrics; drop or rewrite risky labels before storing them; watch the series count; and run monitoring away from what it monitors.

What this simulation simplifies

  • Series leave memory after a fixed time here; real stores keep a recent window, often a couple of hours.
  • The crash recovers by itself in the animation; a real one needs a restart, and data in memory is lost.

How this comes up in interviews

"Design metrics for a service with 10 million users. How do you avoid blowing up the metrics store?"

Then they ask

  1. Where does per-user detail go?
  2. How do you catch a bad label before it ships?
  3. What happens to monitoring during an incident?

A strong answer covers

  • Each unique label combination is a series held in memory.
  • Labels only from small, bounded sets; never user, request or session IDs.
  • Per-user detail in logs and traces; exemplars link metrics to traces.
  • Drop or rewrite risky labels at ingestion; alert on series count.
  • Run monitoring separately from what it monitors.

Points to cover, not a script. Say them in your own words and tie them to a system you have worked on.

On one page: the track cheat sheet.

Last reviewed: Official documentation

Diagrams are our own simulations: the timings, rates and counts in them are illustrative, not measurements. Captions are original wording.