Issue #33 — refactor: Request Correlation IDs
Description
In a microservices or complex backend environment, tracing an error through logs is extremely difficult if requests cannot be distinguished. Attaching a unique Correlation ID to every request allows developers to filter structured logs seamlessly, drastically reducing debugging time.
Requirements & Context
Architectural Goal: Improve system observability and debugging.
Implementation Expectations: Implement Express middleware that generates a uuid or reads X-Correlation-ID headers. Attach it to req.id. Ensure the centralized error handler outputs this ID to the client and the logs.
Acceptance Criteria
Out of Scope
- Distributed tracing spans (e.g., OpenTelemetry setups).
Suggested Execution
git checkout -b refactor/correlation-ids
Suggested Commit Message
refactor: implement request correlation ids for traceability
Testing Notes
- Trigger an API error and verify the Correlation ID exists in both the HTTP response and the server logs.
References
Best practices for Node.js logging and traceability.
Definition of Done
Issue #33 — refactor: Request Correlation IDs
Description
In a microservices or complex backend environment, tracing an error through logs is extremely difficult if requests cannot be distinguished. Attaching a unique Correlation ID to every request allows developers to filter structured logs seamlessly, drastically reducing debugging time.
Requirements & Context
Architectural Goal: Improve system observability and debugging.
Implementation Expectations: Implement Express middleware that generates a
uuidor readsX-Correlation-IDheaders. Attach it toreq.id. Ensure the centralized error handler outputs this ID to the client and the logs.Acceptance Criteria
Out of Scope
Suggested Execution
Suggested Commit Message
Testing Notes
References
Best practices for Node.js logging and traceability.
Definition of Done