Skip to content

Conversation

@MasterPtato
Copy link
Contributor

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

@railway-app railway-app bot temporarily deployed to rivet-frontend / rivet-pr-4094 February 2, 2026 22:11 Destroyed
@railway-app
Copy link

railway-app bot commented Feb 2, 2026

🚅 Deployed to the rivet-pr-4094 environment in rivet-frontend

Service Status Web Updated (UTC)
mcp-hub ✅ Success (View Logs) Web Feb 4, 2026 at 6:51 pm
website ✅ Success (View Logs) Web Feb 4, 2026 at 6:51 pm
frontend-inspector 🕒 Building (View Logs) Web Feb 4, 2026 at 6:49 pm
frontend-cloud 🕒 Building (View Logs) Web Feb 4, 2026 at 6:49 pm

Copy link
Contributor Author

MasterPtato commented Feb 2, 2026

Warning

This pull request is not mergeable via GitHub because a downstack PR is open. Once all requirements are satisfied, merge this PR as a stack on Graphite.
Learn more


How to use the Graphite Merge Queue

Add the label merge-queue to this PR to add it to the merge queue.

You must have a Graphite account in order to use the merge queue. Sign up using this link.

An organization admin has enabled the Graphite Merge Queue in this repository.

Please do not merge from GitHub as this will restart CI on PRs being processed by the merge queue.

This stack of pull requests is managed by Graphite. Learn more about stacking.

@graphite-app graphite-app bot changed the base branch from 02-02-fix_gateway_prevent_timeout_after_hibernation_wake_improve_logging to graphite-base/4094 February 3, 2026 00:25
@graphite-app graphite-app bot force-pushed the graphite-base/4094 branch from 74c7d51 to b9334b3 Compare February 3, 2026 00:26
@graphite-app graphite-app bot force-pushed the 02-02-fix_api_use_matched_path_to_reduce_metric_cardinality branch from 85ce425 to bdba6ac Compare February 3, 2026 00:26
@railway-app railway-app bot temporarily deployed to rivet-frontend / rivet-pr-4094 February 3, 2026 00:26 Destroyed
@graphite-app graphite-app bot changed the base branch from graphite-base/4094 to main February 3, 2026 00:27
@graphite-app graphite-app bot force-pushed the 02-02-fix_api_use_matched_path_to_reduce_metric_cardinality branch from bdba6ac to 89f49de Compare February 3, 2026 00:27
@railway-app railway-app bot temporarily deployed to rivet-frontend / rivet-pr-4094 February 3, 2026 00:27 Destroyed
@pkg-pr-new
Copy link

pkg-pr-new bot commented Feb 3, 2026

More templates

@rivetkit/cloudflare-workers

pnpm add https://pkg.pr.new/rivet-dev/rivet/@rivetkit/cloudflare-workers@4094

@rivetkit/db

pnpm add https://pkg.pr.new/rivet-dev/rivet/@rivetkit/db@4094

@rivetkit/framework-base

pnpm add https://pkg.pr.new/rivet-dev/rivet/@rivetkit/framework-base@4094

@rivetkit/next-js

pnpm add https://pkg.pr.new/rivet-dev/rivet/@rivetkit/next-js@4094

@rivetkit/react

pnpm add https://pkg.pr.new/rivet-dev/rivet/@rivetkit/react@4094

rivetkit

pnpm add https://pkg.pr.new/rivet-dev/rivet/rivetkit@4094

@rivetkit/sql-loader

pnpm add https://pkg.pr.new/rivet-dev/rivet/@rivetkit/sql-loader@4094

@rivetkit/virtual-websocket

pnpm add https://pkg.pr.new/rivet-dev/rivet/@rivetkit/virtual-websocket@4094

@rivetkit/engine-runner

pnpm add https://pkg.pr.new/rivet-dev/rivet/@rivetkit/engine-runner@4094

@rivetkit/engine-runner-protocol

pnpm add https://pkg.pr.new/rivet-dev/rivet/@rivetkit/engine-runner-protocol@4094

commit: 7b579e8

@MasterPtato MasterPtato force-pushed the 02-02-fix_api_use_matched_path_to_reduce_metric_cardinality branch from 89f49de to 7b579e8 Compare February 4, 2026 18:49
@railway-app railway-app bot temporarily deployed to rivet-frontend / rivet-pr-4094 February 4, 2026 18:49 Destroyed
@graphite-app
Copy link
Contributor

graphite-app bot commented Feb 4, 2026

Merge activity

  • Feb 4, 6:50 PM UTC: MasterPtato added this pull request to the Graphite merge queue.
  • Feb 4, 6:51 PM UTC: CI is running for this pull request on a draft pull request (#4113) due to your merge queue CI optimization settings.
  • Feb 4, 6:51 PM UTC: Merged by the Graphite merge queue via draft PR: #4113.

graphite-app bot pushed a commit that referenced this pull request Feb 4, 2026
# 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
@claude
Copy link

claude bot commented Feb 4, 2026

Code Review

Summary

This 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., /users/123/users/:id).

Positive Findings ✅

  1. Excellent cardinality reduction - Using MatchedPath ensures that paths with dynamic segments (like /users/:id) are recorded as templates rather than individual values, preventing metric explosion
  2. Proper fallback handling - Gracefully falls back to raw path when matched path is unavailable
  3. Code simplification - Removed unnecessary cloning (method_clone, path_clone) since the async block already captures the values
  4. Consistent implementation - The matched path is already being used for tracing on lines 72-74, so this change creates consistency between metrics and tracing

Suggestions

1. Typo in Comment

Line 94 has a typo:

// Used matched path if it exists

Should be:

// Use matched path if it exists

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 ✅

  • Before: String allocation for every unique path (unbounded)
  • After: String allocation only for route templates (bounded by API surface)
  • Impact: Significantly reduced memory usage and metric storage overhead

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 Coverage

The change is straightforward and covered by existing integration tests.

Verdict

LGTM with minor typo fix 🎯

The core change is excellent and solves a real observability problem.

@graphite-app graphite-app bot closed this Feb 4, 2026
@graphite-app graphite-app bot deleted the 02-02-fix_api_use_matched_path_to_reduce_metric_cardinality branch February 4, 2026 18:51
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.

1 participant