Skip to content

Monitoring glossary

What is metric cardinality?

Cardinality is the number of unique time series a metric creates. Add the wrong label and one metric becomes millions of series, with the bill and slow dashboards to match.

3 min read9 sectionsUpdated

On this page

Key points

  • Each unique combination of label values is a separate time series.
  • Series multiply: 50 routes × 5 status codes × 20 pods = 5,000 series for one metric.
  • Never use IDs, emails or raw URLs as metric labels.
  • Keep per-request detail in traces and logs, where high cardinality is expected.

How series multiply

A metric such as http_requests_total with labels route, status and pod creates one series for each combination actually seen. The worst-case count is the product of the label cardinalities:

LabelsDistinct valuesSeries
route5050
route × status50 × 5250
route × status × pod50 × 5 × 205,000
… × user_id× 100,000500,000,000

Labels to avoid on metrics

  • User, session, order or request IDs: unbounded.
  • Raw URLs such as /orders/84213: use the route template /orders/:id.
  • Email addresses, IPs, full user agents: unbounded and personal.
  • Timestamps or random values: every sample becomes a new series.
  • Error messages with embedded values: normalize to an error type.

Where detail belongs instead

Metrics are for aggregates: how many, how fast, how often. Detail about individual requests belongs in traces and logs, which store one record per event and are designed to be searched by high-cardinality fields. The pattern that works: a low-cardinality metric raises the alert, and its exemplars or the APM view lead you to the individual traces with all the detail.

Controlling cardinality

  1. Review new labels in code review, asking "how many values can this take?"
  2. Normalize routes in instrumentation. APM tools such as VitalRix replace IDs, UUIDs, tokens and dates in routes with placeholders.
  3. Drop or rename labels in a Collector with the attributes or transform processors before export.
  4. Watch your series count and ingest volume. In VitalRix, usage controls show daily metric points and let you set caps so one bad deploy cannot run up the bill.

Fixing a real cardinality problem

A team adds path as a label on their request counter. After a week the metric has 380,000 series, because every product page, search query and tracking parameter produced a new path. Dashboards slow down and the bill doubles.

The fix has three parts: replace path with the route template (/products/:slug), drop query strings entirely, and add an allow-list of values for any label that comes from user input. The series count falls to about 600 and nothing useful is lost, because per-request detail is still in traces.

Frequently asked questions

Is high cardinality always bad?

In metrics, it is costly. In traces and event data, it is what lets you find problems that only affect one customer or build, so modern observability tools embrace it there.

How do I find the metric causing the problem?

Count series per metric name in your backend, then per label. Usually one label on one metric accounts for most of the growth.

Watch your own site and services with VitalRix

Uptime checks, APM, logs, real-user monitoring, alerts and status pages in one place. Every product has a free tier and no credit card is needed.