-
Notifications
You must be signed in to change notification settings - Fork 151
fix(api): use matched path to reduce metric cardinality #4094
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
fix(api): use matched path to reduce metric cardinality #4094
Conversation
|
🚅 Deployed to the rivet-pr-4094 environment in rivet-frontend
|
74c7d51 to
b9334b3
Compare
85ce425 to
bdba6ac
Compare
bdba6ac to
89f49de
Compare
89f49de to
7b579e8
Compare
Merge activity
|
# Description Please include a summary of the changes and the related issue. Please also include relevant motivation and context. ## Type of change - [ ] Bug fix (non-breaking change which fixes an issue) - [ ] New feature (non-breaking change which adds functionality) - [ ] Breaking change (fix or feature that would cause existing functionality to not work as expected) - [ ] This change requires a documentation update ## How Has This Been Tested? Please describe the tests that you ran to verify your changes. ## Checklist: - [ ] My code follows the style guidelines of this project - [ ] I have performed a self-review of my code - [ ] I have commented my code, particularly in hard-to-understand areas - [ ] I have made corresponding changes to the documentation - [ ] My changes generate no new warnings - [ ] I have added tests that prove my fix is effective or that my feature works - [ ] New and existing unit tests pass locally with my changes
Code ReviewSummaryThis PR improves metric cardinality by using the matched route pattern instead of the raw request path. This is an important fix that prevents unbounded metric labels from dynamic path parameters (e.g., Positive Findings ✅
Suggestions1. Typo in CommentLine 94 has a typo: Should be: 2. Consider DRY Principle (Optional Enhancement)The matched path extraction logic is duplicated between lines 72-74 (for tracing) and lines 95-99 (for metrics). You could extract this once. This is a minor optimization, not a blocking issue. Performance Considerations ✅
Security Considerations ✅No security concerns. This change actually improves security posture slightly by preventing potential DoS via metric cardinality explosion from malicious path requests. Test CoverageThe change is straightforward and covered by existing integration tests. VerdictLGTM with minor typo fix 🎯 The core change is excellent and solves a real observability problem. |

Description
Please include a summary of the changes and the related issue. Please also include relevant motivation and context.
Type of change
How Has This Been Tested?
Please describe the tests that you ran to verify your changes.
Checklist: