Prometheus memory has grown to 60 GB and keeps climbing. How do you find the cause?
IntermediateScenarioPrometheus and PromQL at Scale
Answer
Situation read → Prometheus memory scales mainly with active series (head block cardinality). A sudden climb means a label explosion.
What I'd do →
- Open
/tsdb-statusin the UI (or the API) to see top metrics by series count and top labels by value count. - Query the series growth:
prometheus_tsdb_head_seriesandrate(prometheus_tsdb_head_series_created_total[5m]). - Find the top offenders:
topk(10, count by (__name__) ({__name__=~".+"}))
- Drop or relabel the bad label using
metric_relabel_configsandlabeldrop/drop, or fix the app. - Set
sample_limit/label_limitper scrape job as a guardrail.
Why → Memory is roughly proportional to active series, so you must find which metric or label has exploded.
Interview tip → Mention promtool tsdb analyze for offline inspection.
More on Prometheus and PromQL at Scale
A developer added `user_id` as a metric label. What is the problem and what do you advise?BeginnerYour dashboard shows the average of per-pod p99 latencies. Why is it wrong, and how do you compute a correct fleet-wide p99?IntermediateChoose histogram bucket boundaries for a service with a 300 ms latency SLO.AdvancedYou have 500 short-lived batch jobs that finish before Prometheus can scrape them. How do you capture their metrics?IntermediateYour EC2 fleet autoscales constantly. How do you keep Prometheus targets up to date?IntermediateYou run 3 Kubernetes clusters. Compare federation, remote_write and Thanos sidecar for a global view.Advanced