cardinality
The number of distinct values a metric label can take, which multiplies how many separate series a metric creates.
In more detail
Putting a user identifier or a full address into a label creates unbounded series and a memory problem. Use bounded labels such as operation, status family and dependency outcome.
Example
4 methods × 20 routes × 6 statuses × 12 instances = 5,760 series; add user_id with 50,000 values and it becomes 288 million.Related terms
- metric — A number measured over time, such as requests per second or error count, that shows how a system behaves in aggregate.
- observability — How well you can understand what a system is doing, and why, from the data it emits: mainly logs, metrics and traces.
- metric label — A name and value attached to a metric, such as status="200", that splits one metric into separate series you can compare.
- time series — A sequence of timestamped values for one metric name with one exact set of label values.
- histogram bucket — One counter inside a histogram that counts every observation at or below its upper boundary.
Taught in
- Observability: Logs, Metrics, Traces — Modern API Architecture: REST, GraphQL & gRPC
- Cardinality And How It Bankrupts You — Full-Stack Observability: Metrics, Tracing & Logging
- PromQL Basics And Selectors — Full-Stack Observability: Metrics, Tracing & Logging
- Instrumenting A Service With Client Libraries — Full-Stack Observability: Metrics, Tracing & Logging
- Off By Five: What Prometheus Is Not For — Prometheus Certified Associate (PCA) Exam Prep
- A Database You Cannot Recompile: Exporters — Prometheus Certified Associate (PCA) Exam Prep
- Milliseconds Versus Seconds: Naming Metrics And Labels — Prometheus Certified Associate (PCA) Exam Prep
- Observability As A Design Input — Scalable System Design & Distributed Architecture
- Worked Design Three: A Metrics Ingestion Pipeline — Scalable System Design & Distributed Architecture
- Worked Design Three: Scaling The Metrics Pipeline — Scalable System Design & Distributed Architecture
References
- Prometheus: Metric and label naming
- Prometheus: instrumentation best practices
- Grafana Mimir documentation: Architecture