Problem
No correlation ID is generated or propagated. When a request fails it is impossible to correlate the client error with a specific backend log line, especially once Sentry and structured logs are both in play.
Expected behaviour
- Every request gets a unique ID (UUID v4 or similar)
- The ID is read from
X-Request-ID if the caller provides one, otherwise generated
- The ID is set on the Gin context and included in all log lines for that request
- The ID is returned in the
X-Request-ID response header
Acceptance criteria
Problem
No correlation ID is generated or propagated. When a request fails it is impossible to correlate the client error with a specific backend log line, especially once Sentry and structured logs are both in play.
Expected behaviour
X-Request-IDif the caller provides one, otherwise generatedX-Request-IDresponse headerAcceptance criteria
internal/transport/middleware/request_id.goroutes.gobackend/docs/