Example: a safe initial design
Imagine a payment service where you want to count every payment processed. You add a counter namedpayments_processed_total and choose labels that are bounded and predictable:
provider(Stripe, PayPal, Square)currency(usd, eur)result(success, declined, timeout)
What goes wrong: adding unbounded labels
If someone proposes adding per-entity labels likecustomer_id or transaction_id, the cardinality profile changes dramatically.
For example, adding a customer_id label yields time series like:

A useful rule of thumb: if a label can take more than ~100,000 unique values over time, question whether it belongs in your metrics. Prefer bounded labels in metrics and keep high-cardinality identifiers in logs or traces.
What “cardinality” means in Prometheus
Cardinality = the total number of unique time series Prometheus stores. Each unique combination of metric name and label set is a separate time series. For example, all of these are distinct series:payments_processed_total{provider="Stripe", currency="usd", result="success"}payments_processed_total{provider="Stripe", currency="usd", result="success", customer_id="cust_90210"}payments_processed_total{provider="Stripe", currency="usd", result="success", customer_id="cust_90210", transaction_id="txn_a8f3e9"}
- Prometheus keeps active time series in memory. Millions of series drastically increase RAM usage and can make your Prometheus server crash and restart.
- Managed platforms (e.g., Grafana Cloud, Grafana Mimir) often bill based on active series, so one bad high-cardinality label can increase costs dramatically.
Quick reference — Good vs Bad label choices
Concrete mitigation strategies
- Aggregate at instrumentation time: record counters with only bounded labels (e.g., aggregate per provider/result) and compute per-customer metrics offline if needed.
- Use logs or tracing for unique identifiers: put
customer_id,transaction_id, IPs, emails, and UUIDs in structured logs or traces, not metric labels. - Use Prometheus relabeling to drop high-cardinality labels before ingestion (e.g.,
relabel_configsin scrape configs). - Employ recording rules to precompute and store useful aggregations rather than creating many granular series.
- Use exemplars (OpenMetrics/OpenTelemetry) to link individual metric values to traces without adding the trace ID as a label.
- Test and measure: deploy a version of your exporter or service with and without the label and compare active series count, RAM usage, and billing.
Avoid adding per-entity identifiers (customer IDs, transaction IDs, emails, IPs, UUIDs) as metric labels. These values belong in logs or tracing systems — adding them to metrics will likely blow up cardinality and can cause outages or huge costs.
Example cardinality calculation
- Base series: 3 providers × 2 currencies × 3 results = 18 series
- With 1,000 customers: 18 × 1,000 = 18,000 series
- With 1,000,000 customers: 18 × 1,000,000 = 18,000,000 series
How to validate in your environment
You can deploy two versions of the same API — one that uses only bounded labels and one that includes an unbounded label — and observe the impact:- Monitor active series count (Prometheus
prometheus_tsdb_head_seriesor your managed provider’s metrics). - Track Prometheus memory usage and CPU.
- Compare query latency for common dashboards.
- Review billing metrics if using a managed metrics backend.