Skip to content

feat: add request correlation and structured logging middleware#299

Merged
ArthurCRodrigues merged 1 commit intomainfrom
feat/unified-log-ingestion
Apr 22, 2026
Merged

feat: add request correlation and structured logging middleware#299
ArthurCRodrigues merged 1 commit intomainfrom
feat/unified-log-ingestion

Conversation

@ArthurCRodrigues
Copy link
Copy Markdown
Member

  • Add HTTP middleware to handle X-Request-ID propagation and response headers
  • Implement async context variable (ContextVar) for per-request logging
  • Extend JSON formatter with service, env, method, path, status, duration_ms
  • Add RequestContextFilter to inject request_id into all log records
  • Configure uvicorn log routing to maintain JSON/human format consistency
  • Add environment variables: LOG_LEVEL, SERVICE_NAME, APP_ENV for structured logs

- Add HTTP middleware to handle X-Request-ID propagation and response headers
- Implement async context variable (ContextVar) for per-request logging
- Extend JSON formatter with service, env, method, path, status, duration_ms
- Add RequestContextFilter to inject request_id into all log records
- Configure uvicorn log routing to maintain JSON/human format consistency
- Add environment variables: LOG_LEVEL, SERVICE_NAME, APP_ENV for structured logs

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Copilot AI review requested due to automatic review settings April 22, 2026 14:19
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot encountered an error and was unable to review this pull request. You can try again by re-requesting a review.

Copy link
Copy Markdown
Member Author

@ArthurCRodrigues ArthurCRodrigues left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

OK

@ArthurCRodrigues ArthurCRodrigues merged commit 79f80ac into main Apr 22, 2026
6 checks passed
@ArthurCRodrigues ArthurCRodrigues deleted the feat/unified-log-ingestion branch April 22, 2026 23:56
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.

2 participants