Add useful logging, metrics, and tracing to a service
Plans the instrumentation a service needs so you can answer what broke, where, and for whom when something goes wrong.
The prompt
Help me add observability to a service.
Service purpose: [WHAT IT DOES]
Stack: [LANGUAGE, FRAMEWORK, HOW IT'S DEPLOYED]
Observability tools: [e.g. "OpenTelemetry", "Datadog", "Prometheus + Grafana", "CloudWatch", "none yet"]
Key code paths: [PASTE HANDLERS OR DESCRIBE MAIN FLOWS]
Questions I can't answer today: [e.g. "why some requests are slow", "which customer is affected"]
Produce:
1. Logs: what to log at each level (error, warn, info, debug), a structured log format with standard fields (timestamp, level, request/trace ID, user or tenant ID, operation, duration, outcome), and what must never be logged (passwords, tokens, full card numbers, personal data).
2. Metrics: for each main flow, the RED metrics (rate, errors, duration) plus resource and business metrics worth tracking. Name each metric, its type (counter, gauge, histogram), and labels. Warn about high-cardinality labels like user IDs.
3. Traces: which spans to create, what attributes to attach, and how to propagate context across HTTP calls, queues, and background jobs.
4. Code examples: instrumentation for 1-2 of my code paths in my stack.
5. Dashboard: the 6-8 panels to put on the service's main dashboard.
Prioritize: label each item "do first", "next", or "nice to have", so I can ship value in a day rather than boiling the ocean.
Highlighted [brackets] are blanks to replace with your own details.
Fill in the blanks and use this promptMore Software Development prompts
What to fill in
- WHAT IT DOES
- LANGUAGE, FRAMEWORK, HOW IT'S DEPLOYED
- PASTE HANDLERS OR DESCRIBE MAIN FLOWS
How this prompt is built
This prompt follows the Few-Shot structure (Few-shot prompting). A few-shot prompt includes one or more worked examples of the input and the output you want, so the model can copy the pattern instead of guessing it.
Related prompts
- Break my first coding project into small buildable stepsA milestone plan where every step leaves you with a working program and tells you what to learn next.
- Get unstuck on a coding error with hints instead of the answerA plain-English explanation of your error and step-by-step hints, so you learn to debug instead of copying a fix.
- Write precise TypeScript types for my data and APIsSafer, readable TypeScript types that rule out impossible states, replace unsafe casts, and come with compile-time tests.
- Write a style guide that documents my app's existing design codeReverse-engineers colors, typography, spacing, and component patterns from your codebase into a STYLE_GUIDE.md developers and AI agents can follow.