feat(framework): implement centralized request ID management framework#9554
Merged
bernard-eugine merged 22 commits intomainfrom Nov 12, 2025
Merged
feat(framework): implement centralized request ID management framework#9554bernard-eugine merged 22 commits intomainfrom
bernard-eugine merged 22 commits intomainfrom
Conversation
- Change feature flag logic to make UUID v7 default (no feature flag required) - UUID v4 is now behind `uuid-v4-generator` feature flag for backward compatibility - Update Cargo.toml feature configuration to reflect new defaults - Remove `uuid_v7` feature from tracing-actix-web to prevent conflicts This change improves database performance by using time-ordered UUIDs and provides better chronological sorting without additional metadata.
94310e3 to
338d03a
Compare
maverox
commented
Sep 25, 2025
maverox
commented
Sep 25, 2025
…ting - Add TraceHeaderConfig to router settings with configurable header_name - Update RequestIdentifier middleware to accept String instead of &'static str - Modify get_application_builder to use configurable trace header - Add trace_header configuration to all relevant TOML files - Set default header_name to 'x-request-id' for backward compatibility 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <noreply@anthropic.com>
jarnura
previously approved these changes
Oct 6, 2025
tsdk02
previously approved these changes
Oct 7, 2025
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #9554 +/- ##
=======================================
Coverage ? 4.08%
=======================================
Files ? 1229
Lines ? 305123
Branches ? 0
=======================================
Hits ? 12463
Misses ? 292660
Partials ? 0 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
Replace infallible From implementations with TryFrom to properly handle empty string validation: - From<String> → TryFrom<String> with empty check - From<&str> → TryFrom<&str> with empty check - Remove From<RequestId> for HeaderValue (hardcoded fallback removed) - Rename new_from_string() → try_from_string() returning Result These changes ensure proper error handling at type conversion boundaries and eliminate implicit error cases.
su-shivanshmathur
previously approved these changes
Nov 10, 2025
SanchithHegde
previously approved these changes
Nov 10, 2025
su-shivanshmathur
approved these changes
Nov 10, 2025
SanchithHegde
approved these changes
Nov 11, 2025
ShankarSinghC
approved these changes
Nov 11, 2025
jarnura
approved these changes
Nov 11, 2025
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
This PR implements a comprehensive solution for centralized request ID management, enabling robust distributed tracing by consuming upstream request_id and passing it to UCS as x-session-id for end-to-end correlation.
Closes #9553
Key Changes
🎯 Core Implementation
router_envcrate for single source of truth🔧 Technical Improvements
📋 Detailed Changes
crates/router_env/src/request_id.rsX-Request-Idheader consumption with configurableIdReusepolicyRequestIdextractor for handlers with proper error handlingcrates/router_env/src/request_id_span.rsRequestIdRootSpanBuilderimplementationroot_span!macro to prevent duplicate request_id generationcrates/router_env/Cargo.tomluuid_v7feature fromtracing-actix-webto prevent conflictscrates/router/src/middleware.rsRequestIdmiddleware implementation (70+ lines)router_envfor backward compatibilitycrates/router/src/lib.rsrouter_env::RequestIdentifierwithRequestIdRootSpanBuilderDistributed Tracing Benefits
✅ Robust Request Correlation
📊 Observability Improvements
UCS Integration
x-session-id Implementation
Security Considerations
IdReuse::IgnoreIncomingfor security-sensitive environmentsTesting
Manual Testing
Integration Points
Migration Guide
For Developers
For Deployment
Backward Compatibility
RequestIdusage continues to workx-request-idby defaultDocumentation
Checklist
X-Request-Idheader presentReview Focus Areas
Testing
Request
logs