Services

Resources

Company

/

Cardinality

Cardinality

Cardinality, in metrics systems, is the number of unique time series a metric creates. Every distinct combination of label values is a separate series that must be stored, indexed and queried. High cardinality means a metric has so many combinations that it strains the backend and raises cost.

How it works

Series count is the product of the number of values for each label. An http_requests_total metric with 5 routes, 4 methods and 6 status codes makes 120 series. Add a user_id label with 100,000 users and the same metric can reach 12 million series. Identifiers like user IDs, request IDs and pod IDs are the usual causes. Stable labels such as route, method, status, region or tenant tier keep counts bounded.

Why it matters in production

High cardinality slows queries, increases memory use in tools like Prometheus, and is a common driver of observability bills. In autoscaling clusters, labels such as pod IDs also churn, which creates series that are written once and never queried. Put per-request detail in traces or logs instead.

See also

On the One2N blog

References

  1. Metric and label naming (Prometheus documentation)

  2. Instrumentation: do not overuse labels (Prometheus documentation)

Grid diagram of cardinality for the metric http_requests_total: 5 route rows by 4 method columns (GET, POST, PUT, DELETE), with 6 small squares in each cell for 6 status codes. Every square is one series, so 5 × 4 × 6 = 120 series. Beside the grid, adding a user_id label with 100,000 values multiplies that by 100,000, and the result, 12 million series, is shown in red.

Putting this into practice?

Talk to One2N about our SRE consulting

Talk to One2N about our SRE consulting