Pcornel
Observability · Observability Fundamentals

Cardinality

Cheat sheet · https://pcornel.dk/topic.php?topic=6203

Back to the Topic

Answer

Cardinality is the number of unique label combinations (time series) for a metric. Unbounded labels such as user ID, request ID or full URL explode memory and cost.

Remember

Labels must have bounded values. Use templates for paths (/users/:id). Find top series in the TSDB status page and drop labels with relabelling.

First checks

  • topk(10, count by (__name__)({__name__=~".+"})) — first check for this topic
  • curl -s localhost:9090/-/ready — Prometheus ready
  • curl -s 'localhost:9090/api/v1/query?query=up' — scrape targets up/down
  • promtool check config prometheus.yml — config valid

Verify in this order

label values × labels → series count → memory/cost

Where it usually breaks

A new label with request paths can multiply series overnight.

Read-only verification commands unless stated otherwise. Confirm syntax for your platform and release. Full reference: https://pcornel.dk/topic.php?topic=6203

Confirmation

Confirm action

Continue?