DELAPARRA
Index
Color
NL
Category: Observability

cardinality

Explained by Updated

What is cardinality?

cardinality: The number of unique label combinations a metric has. High cardinality (e.g. user_id as a label) blows up storage and cost. Cardinality in monitoring is the number of unique combinations of label values a metric has. A metric http_requests with labels for method and status code has a few dozen combinations. Add user_id as a label and it can have millions.

Definition source Coders Lingo, CC BY 4.0

Frequently asked questions about cardinality

How is cardinality used in practice?

Every combination is stored as a separate time series. High cardinality makes monitoring systems like Prometheus slow and expensive, and can crash them outright.

What should you keep in mind with cardinality?

Keep labels to values with a small, fixed set of options: endpoint name, status class, region. Put unique identifiers such as user IDs, order numbers or full URLs in logs or traces instead, where they belong. A useful rule is to ask whether you would ever draw a separate line on a graph for each value. If not, it should not be a label.

What does an example of cardinality look like?

http_requests{user_id="..."} → millions of series = bad

At a glance

CategoryObservability
Explained by
Updated

More Observability terms

All terms starting with C

Skills

Download all skills (zip)

Manuals

Related services

Need any help?

Stuck on one of these in your own project? Tell me what you are working on and I will tell you how I would approach it.