A third-party exporter emits 40,000 series you never use. How do you drop them at ingest?
IntermediateScenarioPrometheus and PromQL at Scale
Answer
Situation read → You are paying memory and storage for series nobody queries. Drop them after scrape, before storage.
What I'd do →
- Use
metric_relabel_configs, which runs on scraped samples.
metric_relabel_configs:
- source_labels: [__name__]
regex: "go_gc_.*|http_request_size_bytes_.*|unused_metric_.*"
action: drop
- regex: "pod_template_hash|controller_revision_hash"
action: labeldrop
- Verify with
prometheus_target_scrape_pool_...andscrape_samples_post_metric_relabeling. - Prefer an allowlist (
action: keep) for noisy exporters. - Confirm no dashboards or alerts use the dropped names first.
Why → Dropping in relabeling is cheaper than storing and ignoring.
Interview tip → relabel_configs is for targets, metric_relabel_configs is for samples, a favorite quiz question.
More on Prometheus and PromQL at Scale
Prometheus memory has grown to 60 GB and keeps climbing. How do you find the cause?IntermediateA 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?Intermediate