Commit a3875c5
authored
feat(remix): Add parameterized transaction naming for routes (#17951)
This PR adds parameterized routes for Remix SDK, similarly to the NextJS
SDK
Resolves: #16690
_Needs docs PR for the Vite plugin_
Adds automatic parameterization of Remix route IDs for transaction
naming. Converts internal Remix route file patterns to parameterized
paths similar to the other SDKs (`routes/user.$id` -> `/user/:id`).
- Created `sentryRemixVitePlugin` that extracts route information from
Remix builds and generates a manifest file containing route ID to
parameterized route mappings.
- Added `remixRouteParameterization.ts` with regex-based route
conversion that handles dynamic segments (`$param` → `:param`), splat
routes (`$` → `:*`), and nested routes.
- Updated both client and server instrumentation in `performance.tsx`
and `instrumentServer.ts` to use parameterized transaction names.
- It also works with Hydrogen
Vite plugin is used like:
```javascript
// vite.config.ts
import { defineConfig } from 'vite';
import { vitePlugin as remix } from '@remix-run/dev';
import { sentryRemixVitePlugin } from '@sentry/remix';
export default defineConfig({
plugins: [
remix(),
sentryRemixVitePlugin({
appDirPath: './app', // Default is 'app' in project root
}),
],
});
```
Updated all Remix E2E test applications to expect parameterized route
names. Added new E2E test application `create-remix-app-v2-non-vite` for
testing backward compatibility for non-Vite builds - these continue to
use `routes/user.$id` format.
## Summary
| Route File | Example URL | Before | After (Server - All Apps) | After
(Client - Vite Plugin) |
|------------|-------------|--------|---------------------------|------------------------------|
| `_index.tsx` | `/` | `routes/_index` | `/` | `/` |
| `user.$id.tsx` | `/user/123` | `routes/user.$id` | `/user/:id` |
`/user/:id` |
| `users.$userId.posts.$postId.tsx` | `/users/123/posts/456` |
`routes/users.$userId.posts.$postId` | `/users/:userId/posts/:postId` |
`/users/:userId/posts/:postId` |
| `$.tsx` (splat) | `/docs/guide/intro` | `routes/$` | `/:*` | `/:*` |
| `docs.$.tsx` (scoped splat) | `/docs/guide/intro` | `routes/docs.$` |
`/docs/:*` | `/docs/:*` |
### Notes
- **Server-side**: Parameterization works automatically for all Remix
apps (Vite, non-Vite, Hydrogen, Express).
- **Client-side**: Requires the Vite plugin. Without it, client
transactions continue using route IDs (e.g., `routes/user.$id`).1 parent 3b0728f commit a3875c5
File tree
68 files changed
+3702
-154
lines changed- .github/workflows
- dev-packages/e2e-tests/test-applications
- create-remix-app-express-vite-dev
- tests
- create-remix-app-express
- tests
- create-remix-app-v2-non-vite
- app
- routes
- tests
- create-remix-app-v2
- tests
- remix-hydrogen
- tests
- packages
- cloudflare/src
- remix
- src
- client
- config
- server
- utils
- test
- client
- config
- manifest
- integration
- app/routes
- test
- client
- server
- instrumentation
- utils
- utils
Some content is hidden
Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.
68 files changed
+3702
-154
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
810 | 810 | | |
811 | 811 | | |
812 | 812 | | |
813 | | - | |
| 813 | + | |
814 | 814 | | |
815 | 815 | | |
816 | 816 | | |
| |||
Lines changed: 18 additions & 2 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
3 | 3 | | |
4 | 4 | | |
5 | 5 | | |
6 | | - | |
| 6 | + | |
7 | 7 | | |
8 | 8 | | |
9 | 9 | | |
| |||
15 | 15 | | |
16 | 16 | | |
17 | 17 | | |
18 | | - | |
| 18 | + | |
19 | 19 | | |
20 | 20 | | |
21 | 21 | | |
| |||
28 | 28 | | |
29 | 29 | | |
30 | 30 | | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
| 46 | + | |
31 | 47 | | |
32 | 48 | | |
33 | 49 | | |
| |||
Lines changed: 1 addition & 1 deletion
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
48 | 48 | | |
49 | 49 | | |
50 | 50 | | |
51 | | - | |
| 51 | + | |
52 | 52 | | |
53 | 53 | | |
54 | 54 | | |
| |||
Lines changed: 3 additions & 2 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
1 | 2 | | |
| 3 | + | |
2 | 4 | | |
3 | 5 | | |
4 | 6 | | |
5 | | - | |
6 | | - | |
7 | 7 | | |
8 | 8 | | |
9 | 9 | | |
10 | 10 | | |
11 | 11 | | |
| 12 | + | |
12 | 13 | | |
13 | 14 | | |
14 | 15 | | |
| |||
Lines changed: 2 additions & 2 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
3 | 3 | | |
4 | 4 | | |
5 | 5 | | |
6 | | - | |
| 6 | + | |
7 | 7 | | |
8 | 8 | | |
9 | 9 | | |
| |||
15 | 15 | | |
16 | 16 | | |
17 | 17 | | |
18 | | - | |
| 18 | + | |
19 | 19 | | |
20 | 20 | | |
21 | 21 | | |
| |||
Lines changed: 2 additions & 2 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
90 | 90 | | |
91 | 91 | | |
92 | 92 | | |
93 | | - | |
| 93 | + | |
94 | 94 | | |
95 | 95 | | |
96 | 96 | | |
| |||
132 | 132 | | |
133 | 133 | | |
134 | 134 | | |
135 | | - | |
| 135 | + | |
136 | 136 | | |
137 | 137 | | |
138 | 138 | | |
| |||
Lines changed: 3 additions & 2 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
1 | 2 | | |
| 3 | + | |
2 | 4 | | |
3 | 5 | | |
4 | 6 | | |
5 | | - | |
6 | | - | |
7 | 7 | | |
8 | 8 | | |
9 | 9 | | |
10 | 10 | | |
11 | 11 | | |
| 12 | + | |
12 | 13 | | |
13 | 14 | | |
14 | 15 | | |
| |||
Lines changed: 4 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
Lines changed: 6 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
Lines changed: 2 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
0 commit comments