Skip to content

feat(backend): add X-Request-ID propagation and logging context middleware - #74

Open
BeenaMukiri wants to merge 1 commit into
FinVerify:mainfrom
BeenaMukiri:feat/issue-51-request-id-middleware
Open

BeenaMukiri wants to merge 1 commit into
FinVerify:mainfrom
BeenaMukiri:feat/issue-51-request-id-middleware

Conversation

@BeenaMukiri

Copy link
Copy Markdown

Fixes #51

Summary

  • Added RequestIDMiddleware (app/middleware.py) to accept an incoming X-Request-ID header or generate a UUID4 correlation ID per request, store it in an async-safe ContextVar, and echo X-Request-ID in response headers.
  • Added RequestIDLogFilter and install_request_id_logging() so all LogRecord instances emitted during a request automatically include record.request_id.
  • Exposed X-Request-ID in CORSMiddleware and registered RequestIDMiddleware at the outermost middleware layer in app/main.py.
  • Added async unit and concurrency isolation tests in tests/test_request_id_middleware.py.

Testing

  • pytest tests/test_request_id_middleware.py -v (3 passed)
  • pytest (622 passed)

@vercel

vercel Bot commented Nov 24, 2026

Copy link
Copy Markdown

@BeenaMukiri is attempting to deploy a commit to the aadi's projects Team on Vercel.

A member of the Team first needs to authorize it.

This branch has not been deployed

No deployments
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.

Add request-ID propagation and per-request logging middleware

1 participant