OpenTelemetry Metrics Cardinality Control Prompt
Diagnose and cut runaway metric cardinality in an OpenTelemetry pipeline: find the offending attributes, apply SDK views and Collector transform/filter processors to bound them, and enforce a per-metric series budget before the backend bill explodes.
- Target user
- Observability engineers fighting time-series explosion and metrics cost
- Difficulty
- Advanced
- Tools
- Claude, ChatGPT, Cursor
The prompt
You are a senior observability engineer who controls metrics cost by taming cardinality at the source. I will provide: - The metrics backend, current series count, and cost/limits - The instruments and attributes in play (or how to inspect them) - Which metrics power alerts/SLOs versus exploratory dashboards - Where cardinality hurts (specific metrics, cost spikes, ingest rejections) Your job: 1. **Locate the explosion** — describe how to identify the highest-cardinality metrics and the specific attribute keys driving them (backend cardinality tools, Collector debug, series-by-label breakdown). 2. **Classify attributes** — for each offending key, decide keep / bucket / hash / drop based on whether it is bounded and whether a consumer needs it. 3. **Fix at the SDK** — apply Views to drop or aggregate away attributes, rename to conventions, and set explicit histogram buckets; show the code. Prefer fixing here over the Collector when you own the code. 4. **Fix at the Collector** — for metrics you don't own, use transform/filter processors to remove or rewrite high-cardinality labels and drop unused metrics entirely; show the config. 5. **Bound unbounded values** — replace raw IDs/URLs/paths with bucketed or templated values (route pattern instead of full path, status class instead of exact code where appropriate). 6. **Set a budget** — define a per-metric series budget and an alert on series growth so regressions are caught early. 7. **Validate** — estimate series before/after and confirm no alert/dashboard loses a required dimension. Output as: (a) a ranked table of offending metrics/attributes, (b) SDK View changes, (c) Collector transform/filter config, (d) before/after series and cost estimate, (e) a list of downstream consumers to verify. Flag any attribute drop that would break an existing alert or SLO query.
Run this prompt with AI
Test it, get an AI-improved version, or compare models — live in the Prompt Workspace. No copy-paste.
Related prompts
-
OpenTelemetry Metrics Instrumentation Design Prompt
Design a metrics instrumentation plan with the OpenTelemetry SDK: pick the right instrument types, choose temporality and aggregation, define views to rename and bucket, and control cardinality before metrics reach the backend.
-
OpenTelemetry Prometheus Receiver Migration Prompt
Migrate existing Prometheus scraping into the OpenTelemetry Collector prometheus receiver: preserve relabeling and service discovery, map Prometheus semantics to OTLP metrics, and shard scraping across replicas without gaps or double-counting.
-
OpenTelemetry Tail Sampling Strategy Prompt
Design a tail-based sampling strategy in the OpenTelemetry Collector that keeps errors and slow traces while cutting cost, including decision-wait tuning and trace-ID-aware load balancing across Collector replicas.
-
OpenTelemetry Collector Gateway Scaling & HA Prompt
Design a horizontally scalable, highly available OpenTelemetry Collector gateway tier — autoscaling, load balancing, queue persistence, and zero-loss rolling upgrades — so telemetry survives replica churn and traffic spikes.
More OpenTelemetry prompts & error guides
Browse every OpenTelemetry prompt and troubleshooting guide in one place.
Reading prompts? Get all 500 in one free PDF
500 battle-tested, copy-paste AI prompts engineered by a senior systems engineer — every one with fill-in placeholders and safety/back-out notes. Drop your email and it's yours.
- 500 prompts: Linux · Kubernetes · Terraform · OpenStack · GitLab · Docker · Monitoring · Incident Response
- Instant PDF download — yours free, forever
- Plus one practical AI-workflow email a week (no spam)
Single opt-in · unsubscribe anytime · no spam.