Prompt
My Prometheus storage is filling up too fast, what should I do?
Latest observation
If Prometheus storage is filling up too fast, the usual causes are too many time series, too-high scrape frequency, or too-long retention. Here’s a practical way to tackle it:
1) Check what’s using disk
Look at:
- Number of active series
- Scrape interval per job
- Retention settings (
--storage.tsdb.retention.time,--storage.tsdb.retention.size) - WAL size and block churn
Useful Prometheus metrics:
prometheus_tsdb_head_seriesprometheus_tsdb_storage_blocks_bytesprometheus_tsdb_wal_size_bytesprometheus_tsdb_compactions_failed_totalscrape_samples_scrapedscrape_samples_post_metric_relabeling
2) Reduce cardinality
High-cardinality labels are the most common space hog.
Watch out for labels like:
pod,container,endpoint,instance- request IDs, user IDs, session IDs
- arbitrary paths, URLs, query params
- dynamic labels that change often
Actions:
- Drop unnecessary labels via
metric_relabel_configs - Remove unneeded exporters/metrics
- Aggregate metrics before they reach Prometheus
- Avoid labeling on high-cardinality values
Example to drop a label:
metric_relabel_configs:
- source_labels: [pod]
regex: .*
action: labeldrop
3) Increase scrape interval where acceptable
If you scrape every 15s, consider 30s or 60s for less critical jobs.
Example:
scrape_configs:
- job_name: myjob
scrape_interval: 30s
This reduces samples ingested and disk use.
4) Shorten retention
If you don’t need long historical data, lower retention.
Examples:
--storage.tsdb.retention.time=15d
or limit by size:
--storage.tsdb.retention.size=20GB
You can also use both, depending on your needs.
5) Drop noisy metrics
Some exporters expose a lot of low-value data. Common candidates:
- Per-path HTTP metrics with many unique paths
- Per-pod/container metrics in large clusters
- Debug/internal metrics you don’t use
Use metric_relabel_configs to drop series before ingestion.
6) Consider recording rules
If you mostly query aggregates, use recording rules and drop raw high-volume metrics if possible.
7) Scale storage appropriately
If the data volume is legitimately large:
- Use faster/larger disks
- Separate Prometheus instances by environment/team
- Shard by target/job
- Consider remote storage / long-term storage like Thanos, Cortex, or Mimir
8) Inspect top offenders
In Prometheus UI or via queries, find the most expensive jobs/labels. For example:
topk(20, count by (__name__) ({__name__=~".+"}))count by (job) ({__name__=~".+"})
You can also use:
promtool tsdb analyze <data-dir>
This is very helpful for identifying high-cardinality metrics and labels.
Quick wins
If you want the fastest impact, do these first:
- Increase scrape intervals
- Drop high-cardinality labels/metrics
- Reduce retention
- Use
promtool tsdb analyzeto find offenders
If you want, I can help you diagnose your Prometheus setup if you share:
- your scrape intervals,
- retention flags,
- approximate active series count,
- and a few exporter/job names.