liveBook · Manning

Cardinality

As explained in Cloud Observability in Action

Metric cardinality is the number of distinct values or combinations represented by a metric’s dimensions or labels.

Metric cardinality is the number of distinct values possible in a metric’s dimensions or labels. Higher cardinality creates more time series for a time-series database to store and query. section 2.4.3

A label that triggers cardinality explosion

An HTTP status-code label usually has only a few dozen values and is manageable. Encoding user IDs in a uid label can create tens of thousands, millions, or more possible values, making the metric expensive to store and query. section 2.4.3

Table 2.2 Overview of the costs of metrics (view table figure)

 

Overhead

Considerations

Instrumentation

Auto-instrumentation, if possible

Increasingly supported in programming languages

Agent

Prometheus, OpenTelemetry collector, and OpenMetrics as emerging standard

What to collect and autopruning

Destination

Cardinality, long-term storage, and federation

What to ingest and data temperature for retention

Use the cost overview to compare cardinality with metric instrumentation, agents, retention, long-term storage, and federation. section 2.4.3

How Cloud Observability in Action covers it

How deep it goes
Defines cardinality and demonstrates its cost implications, while deferring detailed cardinality-explosion treatment.
Examples
Contrasts HTTP status-code labels with user-ID labels in metric series.
What it assumes
Assumes basic familiarity with metrics, labels or dimensions, and time-series databases.
What you can do after
Evaluate metric labels for potential storage and query-cost increases.
How it connects
Connects metric cardinality with labels, dimensions, time-series databases, storage, querying, and cardinality explosion.

Also explained in

Compare how 8 books explain cardinality →

Related concepts

This explainer was generated by Manning's knowledge graph from the text of Cloud Observability in Action. The section links point to the parts of the book it draws on.