← Back to microservices patterns mapobserve
🏷️
Microservices Pattern
Correlation ID
Thread a unique request ID through headers, logs, and downstream calls.
Detailed Description
Correlation IDs are a lightweight observability baseline even before full tracing.
They let teams search logs from multiple services for one user request.
Visual Diagram
Correlation ID Flow
Client → Gateway
generates: X-Request-ID: req-789xyz
passes header to all services
UserSvc: log { reqId: "req-789xyz", ... }
OrderSvc: log { reqId: "req-789xyz", ... }
PaymentSvc:log { reqId: "req-789xyz", ... }
Search logs: reqId=req-789xyz → full traceTradeoffs
Pros
Simple and immediately useful
Cons
Must be propagated consistently
Examples: X-Request-ID, express-request-id, Morgan logger