
Observability with Claude Code: OpenTelemetry Distributed Tracing for Node.js
"Why is this API slow?" and "Which service is throwing errors?" are questions you can't answer without observability. Claude Code can design the three pillars — logs, metrics, and traces — when you give it the right patterns. CLAUDE.md for Observability Standards ## Observability Rules ### Three pillars (all required) 1. Logs: pino (structured JSON, PII masking) — see logging.md 2. Metrics: Prometheus format via prom-client 3. Traces: OpenTelemetry (distributed tracing) ### Tracing requirements - All HTTP requests get a trace ID - External API calls and DB operations create child spans - Errors: record exception + set span status to ERROR - Sampling: production 10%, development 100% ### Metrics requirements - Request count: http_requests_total (method, route, statusCode) - Latency: http_request_duration_ms (histogram with p50/p95/p99) - Error rate: http_errors_total (statusCode, route) - Business metrics: order_count, revenue_total, user_registrations_total ### Alert thresholds - Error
Continue reading on Dev.to
Opens in a new tab


