Skip to content

[ENHANCEMENT] Add request ID middleware for improved request tracing#397

Open
Lochit-Vinay wants to merge 7 commits intofireform-core:mainfrom
Lochit-Vinay:add-request-id
Open

[ENHANCEMENT] Add request ID middleware for improved request tracing#397
Lochit-Vinay wants to merge 7 commits intofireform-core:mainfrom
Lochit-Vinay:add-request-id

Conversation

@Lochit-Vinay
Copy link
Copy Markdown

Summary

This PR introduces request ID tracking using middleware to improve debugging and traceability across API requests.

Changes Made

  • Added RequestIDMiddleware using BaseHTTPMiddleware
  • Generates a unique UUID for each incoming request
  • Attaches request_id to request.state
  • Includes request ID in response headers (X-Request-ID)

Example

Response headers:
X-Request-ID: 123e4567-e89b-12d3-a456-426614174000

Why this is useful

  • Helps trace requests across logs and services
  • Improves debugging in concurrent environments
  • Useful for observability and monitoring

Note

I didn’t find any existing issue related to request-level tracing.

Closes #395

@Lochit-Vinay
Copy link
Copy Markdown
Author

Resolved merge conflict by merging request ID middleware with existing CORS configuration from main branch, ensuring both features work together without duplication.

@Lochit-Vinay
Copy link
Copy Markdown
Author

Resolved merge conflicts by integrating request ID middleware with existing CORS and exception handling setup, ensuring no duplication and preserving all functionalities.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[ENHANCEMENT] Add request ID tracking for better debugging and traceability

1 participant