Repository navigation
feat(solid): Name Solid 2 server spans after the matched route - #26634
Conversation
|
bugbot run |
Optional E2E testsAll optional checks were successful. 5 successful. See the run. Successful checks
|
size-limit report 📦Compared: 519cb91 (PR test merge using develop at 0d6ec39) Against: 0d6ec39 (develop) · base run #67275 ✅ Baseline matches: this diff contains only this PR's changes.
|
|
bugbot run |
|
bugbot run |
a6fa935 to
7de1fab
Compare
|
bugbot run |
During SSR, withSentryRouterRouting names the active http.server span after the route the request matched (e.g. GET /user/:id) and sets http.route. Errors captured later in the request carry the same transaction name. Refs JS-4116 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The router wrapper now registers the router when the app module loads and names http.server spans from a spanStart hook, so middleware, redirects and errors before the render already see the route name. Naming during the render stays as a fallback for when init runs after the router is created. Refs JS-4116 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
On the server, the app bundles @solidjs/router while @sentry/solid loads its own copy, so the navigation hooks in the wrapper's render prop threw and every page rendered the error boundary. The server only needs span naming, so the wrapper now renders the router unchanged there. The client effect is transparent, so it takes no hydration id the server never created. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…start Errors before the render, e.g. in middleware, now carry the route name too. Both naming paths set it on the request's isolation scope, never on the process-wide default one. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…wn router The server bundle of a built app can hold a different copy of @solidjs/router than the SDK imports. The test makes the SDK's router hooks throw and checks that the server render still succeeds. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
7de1fab to
2d43e98
Compare
|
bugbot run |
| } | ||
| CLIENTS_NAMING_SERVER_SPANS.add(client); | ||
|
|
||
| client.on('spanStart', span => { |
There was a problem hiding this comment.
this approach depends on tracing being enabled iiuc, is there a way to make this work for error only setups?
There was a problem hiding this comment.
Good catch, without tracing there is no span to hook into, so errors kept the raw path. The render now also sets the route name on the request's isolation scope without a span, so error-only setups get GET /user/:id too.
Without tracing there is no http.server span to hook into, so errors kept the raw path as their transaction name. The render now sets the route name on the request's isolation scope with or without a span. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
commented
Nov 20, 2026
|
bugbot run |
left a comment
There was a problem hiding this comment.
✅ Bugbot reviewed your changes and found no new issues!
Comment @cursor review or bugbot run to trigger another review on this PR
Reviewed by Cursor Bugbot for commit 36e82ab. Configure here.
What
On the server,
withSentryRouterRoutingnow names thehttp.serverspan after the route the request matches, e.g.GET /user/:id, and setshttp.routeand the path parameters. It names the span as soon as it starts, so middleware, redirects and errors before the render already carry the route name.Why
Server spans of Solid 2 apps were only named after the method (
GET). The router is created when the app module loads, afterinitran instart.serverSetup, so the wrapper can register it and match each request when its span starts, without any extra setup.flowchart LR A["Server starts:<br/>Sentry.init()"] --> B["App module loads:<br/>router is registered"] B --> C["Request comes in:<br/>http.server span starts"] C --> D["Match url.path:<br/>GET /user/:id"] D --> E["Middleware, server functions,<br/>render use that name"]Naming during the render stays as a fallback for apps that call
initlater. Server function calls and API routes keep their default names.Stacked on #26627. Closes JS-4116