Join our community: https://t.me/+DOylgFv1jyJlNzM0
Description
API logs have no request correlation ID. When multiple requests are in-flight, their log entries are interleaved with no way to trace a single request's path through the system.
What Needs to Happen
- Generate a UUID request ID on each incoming request (or read
X-Request-ID header if present)
- Attach the request ID to the response as
X-Request-ID header
- Include the request ID in all Winston log entries for that request (use
AsyncLocalStorage)
- Log: request received (method, path, request ID), response sent (status, duration, request ID)
- Include request ID in SSE event payloads for client-side correlation
Files
backend/src/middleware/requestId.ts (create)
backend/src/app.ts
Acceptance Criteria
Description
API logs have no request correlation ID. When multiple requests are in-flight, their log entries are interleaved with no way to trace a single request's path through the system.
What Needs to Happen
X-Request-IDheader if present)X-Request-IDheaderAsyncLocalStorage)Files
backend/src/middleware/requestId.ts(create)backend/src/app.tsAcceptance Criteria
requestIdX-Request-IDheader present on all responsesX-Request-IDis echoed back if valid