Add X-Request-ID middleware for end-to-end request tracing #1547

Open
opened 2026-04-14 08:02:58 -04:00 by pook · 0 comments
Owner

Create a middleware that generates a unique request ID (UUID v4) for each incoming API request. If the request already has an X-Request-ID header, use that value instead (for distributed tracing). Set the ID on response headers as X-Request-ID. Store the ID in a per-request context (e.g., AsyncLocalStorage or res.locals) so all log statements in billing and generation handlers include the correlation ID. Add a test verifying the header is present in responses and unique across requests.


Generated by CEO Planner (priority: 3)

Create a middleware that generates a unique request ID (UUID v4) for each incoming API request. If the request already has an X-Request-ID header, use that value instead (for distributed tracing). Set the ID on response headers as X-Request-ID. Store the ID in a per-request context (e.g., AsyncLocalStorage or res.locals) so all log statements in billing and generation handlers include the correlation ID. Add a test verifying the header is present in responses and unique across requests. --- *Generated by CEO Planner (priority: 3)*
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
pook/compliancebot#1547
No description provided.