SimuVedaSystem Design Lab Open in the lab

Observability / Intermediate / 5 min / Updated

Metric cardinality: the label that breaks Prometheus

Labels multiply time series. Method, route and status are fine; add a user id or raw URL path and watch series, memory and query time explode.

Start the simulation → Change the load, break a part, watch what happens. Free, no sign-up.

In short

What is metric cardinality?

Cardinality is the number of distinct label combinations a metric has; each one is a stored time series.

Why does it matter?

Series count drives memory, query time and cost of a metrics system like Prometheus.

What is the trade-off?

Rich labels help slicing but must be bounded; user ids, raw paths and request ids belong in logs or traces.

How do you explain it in an interview?

"Bounded labels only (method, route template, status, region), cardinality limits per metric, high-detail data in traces."

Check yourself

Labels method (5), route (40), status (8), region (4). How many series can http_requests_total have?

Answer: 6,400. Each combination of label values is its own time series, so counts multiply.

Why is a user id label on a metric a bad idea?

Answer: Every active user becomes a new time series, exploding memory and query time. Put per-user detail in logs or trace attributes; keep metric labels bounded.

Why use route templates like /orders/:id instead of the raw path?

Answer: Raw paths with ids create a new series per id. Bounded label values keep cardinality small; unbounded ones grow forever.

See it happen in the simulation →

cardinalitymetric cardinalityprometheustime serieslabelshigh cardinalitymonitoringobservability

More in observability