feat(v2/httpserver): add CorrelationIDMiddleware

Summary

  • Adds CorrelationIDMiddleware to v2/httpserver that reads the X-Request-ID request header, generates a UUID when absent or whitespace-only, injects the ID into the request context via correlation.InjectToContext, and echoes it as a X-Request-ID response header
  • Wires the middleware unconditionally as the outermost layer in NewWithConfig, ensuring the correlation ID is available to the tracing middleware, access logger, and all downstream handlers
  • Fixes the long-standing gap where correlation_id was always empty in access logs for requests from GitLab services

Test Plan

  • go test ./httpserver/... passes (20 tests including 3 new subtests for the middleware and 1 integration wiring test)
  • Access logs now include correlation_id for requests carrying a X-Request-ID header
  • Requests without the header receive a generated UUID echoed in the response

🤖 Generated with Claude Code

Edited by Elliot Forbes

Merge request reports

Loading
Loading