Chapter 14: Logging and Light Observability
14.7 Correlation IDs — one paragraph that saves hours
A correlation id (also called request id / trace id) is a unique string created at the edge of a request and passed through services and log lines. When /checkout fails, you search that id across API and payment logs instead of matching timestamps by eye.
Beginner habit for badge API: generate or accept an X-Request-Id header; print it on every log line for that request. Full distributed tracing tools (OpenTelemetry, X-Ray, Jaeger…) are the next level — learn the id habit first.
INFO request_id=pb-7f3a path=/badge status=200
ERROR request_id=pb-7f3a path=/checkout err=db_timeout