Prometheus restarts every few minutes with OOMKilled, and the TSDB head series count jumped from 2M to 30M after a deploy.

AdvancedTroubleshootingDisk, memory and CPU
Answer

Likely causes → A cardinality explosion: a new metric label with unbounded values such as user_id, request_id, full URL path, or pod-specific IDs. Every unique combination is a new series, and Prometheus keeps the head block in memory.

Diagnose →

curl -s localhost:9090/api/v1/status/tsdb | jq '.data.seriesCountByMetricName[:10], .data.labelValueCountByLabelName[:10]'

Or in PromQL (once it stays up): topk(10, count by (__name__)({__name__=~".+"})).

Fix → Drop the bad label or metric at scrape time while the app is fixed:

metric_relabel_configs:
  - regex: user_id
    action: labeldrop
  - source_labels: [__name__]
    regex: debug_cache_entry_info
    action: drop

Restart with more memory if needed to replay the WAL.

Prevent → Set sample_limit per scrape job, review new metrics in code review (no IDs as labels), and alert on prometheus_tsdb_head_series growth.

All Real-World Interview questions Roadmap: Interview readiness

More on Disk, memory and CPU