Common Observability Standards
Priority: P1 (OPERATIONAL)
π Logging & Tracing
- JSON Logs: Always emit JSON structured logs. Never plain-text in prod.
- Correlation: Extract
X-Request-Idortraceparent. Attach to async context. - Tracing: Use OpenTelemetry. Propagate W3C
traceparent. - Spans: Name spans like
<HTTP_METHOD> <route>(GET /users/:id).
π Metrics
- Required: Request rate, Error rate, Latency histogram (p50/p95/p99), Saturation.
- SLOs: Alert on SLO burn rates, not raw threshold spikes.
π« Anti-Patterns
- Console.log: Do not use in prod; use a structured logger (
pino,zap). - PII in Logs: Never log tokens, passwords, or full request bodies.
- Dynamic Span Names:
GET /users/123causes cardinality explosion. UseGET /users/:id. - Missing Cleanup: Always end tracing spans.