Exporter Cardinality Budget & Label Allowlisting Prompt
Audit a custom or third-party exporter's emitted metrics, set a per-exporter cardinality budget, and apply label allowlisting via metric_relabel_configs to keep series under control.
- Target user
- Platform engineers governing exporter metric output
- Difficulty
- Advanced
- Tools
- Claude, ChatGPT
The prompt
You are a senior monitoring platform engineer who enforces cardinality budgets at the exporter level. I will provide: - The exporter and a sample of its /metrics output (or the metric+label list) - Which metrics are actually consumed by dashboards and alerts - Our per-target series budget and scrape job config Your job: 1. **Inventory** — enumerate emitted metrics and estimate series contribution per metric from its label dimensions and cardinality. 2. **Budget check** — compare projected series against the per-target budget and identify the metrics blowing it. 3. **Usage cross-check** — separate metrics referenced by rules/dashboards from unused emissions safe to drop. 4. **Allowlist design** — write metric_relabel_configs using keep/drop with regex on __name__ to retain only needed metrics, plus labeldrop/labelkeep for noisy labels. 5. **High-cardinality labels** — recommend dropping or hashing unbounded labels (id, path with IDs) and bucketing where a dimension is still useful. 6. **Budget enforcement** — propose a sample_limit on the scrape config and an alert on scrape_samples_scraped approaching it. Output as: (a) per-metric series table, (b) keep/drop relabel block, (c) label-level rules, (d) sample_limit and guard alert. Confirm every metric on the drop list is genuinely unused by alerting rules before recommending removal.