Calculate total time series cardinality from metric names and label combinations.
Prometheus cardinality is the product of every metric name and the distinct values of every label attached to it — adding a label with N distinct values multiplies your series count by N. Formula: total_series = base_metrics × label1_values × label2_values × label3_values. Labels with unbounded or high-cardinality values (pod names, user IDs, request IDs) are the most common cause of cardinality explosions that exhaust Prometheus memory and slow queries.
Total time series
total_series = base_metrics × label1_values × label2_values × label3_values
Memory footprint
memory_MiB = total_series × bytes_per_series / (1024 × 1024)
Each unique label combination creates a new time series that Prometheus must keep in memory and index. Cardinality explosions can consume gigabytes of RAM, slow down queries, and in extreme cases crash the Prometheus process (OOM).
Labels with values that grow unboundedly or scale with infrastructure churn — pod names, container IDs, user IDs, request IDs, or raw URLs with path parameters — are the usual culprits, unlike bounded labels like status_code or method.
Aggregate high-cardinality labels at collection time, use recording rules to pre-aggregate before long-term storage, or drop/relabel volatile labels (e.g. pod_name) in favor of a stable label like deployment or service.
It's a common rule of thumb for Prometheus's in-memory chunks (varies with churn rate and Prometheus version); use `prometheus_tsdb_head_series` and process memory metrics from your own instance to calibrate a more precise figure.