IT lexicon › Infra & Ops › Metric cardinality

Metric cardinality

Infra & Ops På svenska → Updated: 2026-11-14

The number of unique combinations of labels (server name, region, user ID) on a metric; high cardinality makes storage expensive and queries slow.

A simple metric like request_duration_ms with labels for server, path, method, and status quickly becomes high-cardinality. With 100 servers, 1000 API paths, 5 methods, and 10 status codes, you have 100 × 1000 × 5 × 10 = 5 million unique time series. A label like user_id can balloon cardinality to billions—one series per unique user. Many time-series databases (Prometheus, InfluxDB) degrade under such load or become prohibitively expensive. This is called "cardinality explosion." Solutions involve careful label choices: use server group instead of individual host, and avoid dynamic labels like user_id unless filtered strictly or stored in a high-scale system. Some systems cap cardinality and drop new labels once a threshold is reached.

Cardinality management is a constant tension: you want detailed labels for debugging, but too many kill the system.

← Back to the lexicon