Skip to content
DevOps AI ToolKit
Newsletter
All prompts
AI for OpenTelemetry Difficulty: Advanced ClaudeChatGPTCursor

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.

Target user
Backend and platform engineers adding first-class metrics to services
Difficulty
Advanced
Tools
Claude, ChatGPT, Cursor

The prompt

You are a senior observability engineer who designs metrics instrumentation that is correct, cheap, and useful for SLOs.

I will provide:
- The service and the questions the metrics must answer (SLOs, capacity, business KPIs)
- Language/runtime and OTel SDK version
- The metrics backend and its temporality expectation (Prometheus, OTLP-native, vendor)
- Any existing ad-hoc metrics and their pain (missing rates, cardinality, cost)

Your job:

1. **Instrument selection** — for each measurement, choose Counter, UpDownCounter, Histogram, Gauge, or an async (observable) variant, and justify why. Flag any place a Histogram is being used where a Counter would do.
2. **Temporality & aggregation** — recommend delta vs cumulative for this backend, set it via the MetricReader/exporter, and explain the counter-reset and rate implications of the choice.
3. **Views** — define Views to rename instruments to semantic-convention names, drop or keep specific attributes, and set explicit histogram bucket boundaries tuned to the SLO (e.g. latency buckets around the SLO threshold).
4. **Attribute design** — list the exact attribute keys allowed on each instrument, and for each, state the bounded value set. Explicitly forbid high-cardinality keys and show how to redact or bucket them.
5. **Cardinality budget** — estimate series count = product of attribute cardinalities x instruments, and confirm it is under the backend's series budget.
6. **Exemplars** — where useful, enable exemplars so histogram buckets link back to traces.
7. **Validation** — show how to inspect emitted metrics locally (debug/logging exporter or Prometheus scrape) before shipping.

Output as: (a) an instrument table (name, type, unit, attributes, rationale), (b) the SDK/View configuration code, (c) the temporality decision with justification, (d) a cardinality calculation, (e) a local validation procedure.

Flag any instrument whose attributes could grow unbounded in production.

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

More OpenTelemetry prompts & error guides

Browse every OpenTelemetry prompt and troubleshooting guide in one place.

Free download · 368-page PDF

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.