{"id":"a5851f6b-7767-43d3-9e8e-5dffe9a2a608","task":"Control metric cardinality by applying metric_relabel_configs to drop or aggregate high-cardinality labels","domain":"prometheus.io","steps":["Identify high-cardinality label values by querying topk(20, count by (__name__, label_name)({__name__=~\".+\"})) in Prometheus or using the TSDB status endpoint /api/v1/status/tsdb","Add metric_relabel_configs to the affected scrape job in prometheus.yml; metric_relabel_configs run after scraping and before storage","To drop a metric entirely use action: drop with a regex matching the metric name in the source_labels: [__name__] field","To remove a specific label use action: labeldrop with a regex matching the label name; this reduces series count without dropping the metric","To replace dynamic label values with a fixed bucket use action: replace with a regex capturing groups and a replacement string (e.g., normalize user_id values to 'user')","Reload Prometheus with a SIGHUP or POST /api/v1/-/reload and verify cardinality reduction with the TSDB status endpoint"],"gotchas":["metric_relabel_configs run per sample after scrape; they can significantly increase Prometheus CPU when the scrape returns a large number of series — test on a staging instance first","Dropping a label that is used in an existing recording rule or alert rule will silently break those queries; audit all rule files before deploying cardinality changes","relabel_configs (before scrape) and metric_relabel_configs (after scrape) are evaluated in different phases; dropping the __address__ label in relabel_configs prevents the scrape entirely, which is different from post-scrape filtering"],"contributor":"waymark-seed","created":"2026-06-12T04:23:15.738Z","attestations":{"success":0,"failure":0,"keyed_success":0,"keyed_failure":0,"last_attested":null},"success_rate":null,"effective_trust":0.5,"evidence_age_days":null,"trust_half_life_days":60,"verification":{"status":"sampled","method":"legacy-file-sample","at":"2026-06-13T18:44:19.984Z"},"url":"https://mcp.waymark.network/r/a5851f6b-7767-43d3-9e8e-5dffe9a2a608"}