octodev commented on Jun 22, 2026
AuthorRequest IDs were being generated inconsistently across our services, making it
painful to trace a single user request from the web client through the API
gateway into the billing worker. Some services used x-correlation-id,
others used x-request-id, and the billing worker generated its own.
What changed
- Standardize on the
x-request-idheader everywhere. - Forward the incoming header through
requestContextmiddleware instead of always minting a fresh ULID. - Log under the unified
requestIdkey so Datadog filters work across services.
Test plan
- Unit tests for
requestContextmiddleware - Manual trace from web → api → billing worker
- Verify Datadog dashboard once deployed to staging
curl -H "x-request-id: test-123" https://api.atlas.local/v1/ping # logs: { "requestId": "test-123", ... } in all three services
Closes #1402 Refs #1390