Avoiding Label Cardinality Explosions in Metrics
Practical rules for keeping Prometheus time series bounded across dynamic HTTP routes and user IDs.
Never use raw URLs or client IPs as labels
Unbounded label values turn a harmless request counter into millions of orphaned time series as soon as scanners probe random paths.
Normalizing route patterns before recording histograms—and collapsing unknown paths into a single 'not_found' bucket—keeps memory usage steady on both the exporter and Prometheus.