Skip to content

feat(solid): Name Solid 2 server spans after the matched route - #26634

Merged
chargome merged 6 commits into
developfrom
feat/solid-2-server-routes
Nov 20, 2026
Merged

chargome merged 6 commits into
developfrom
feat/solid-2-server-routes

Conversation

@chargome

@chargome chargome commented Nov 19, 2026 •

Copy link
Copy Markdown
Member

What

On the server, withSentryRouterRouting now names the http.server span after the route the request matches, e.g. GET /user/:id, and sets http.route and 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, after init ran in start.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"]
Loading

Naming during the render stays as a fallback for apps that call init later. Server function calls and API routes keep their default names.

Stacked on #26627. Closes JS-4116

@chargome chargome self-assigned this Nov 19, 2026
@linear-code

linear-code Bot commented Nov 19, 2026

Copy link
Copy Markdown

JS-4116

@chargome

Copy link
Copy Markdown
Member Author

bugbot run

@github-actions

github-actions Bot commented Nov 19, 2026 •

Copy link
Copy Markdown
Contributor

Optional E2E tests

All optional checks were successful. 5 successful. See the run.

Successful checks
Check Status
✅ CI: Optional E2E Tests / E2E nestjs-12 (deno) Test (optional) Successful in 52s Details
✅ CI: Optional E2E Tests / E2E nestjs-12 (cloudflare) Test (optional) Successful in 45s Details
✅ CI: Optional E2E Tests / E2E solidstart-2 Test (optional) Successful in 55s Details
✅ CI: Optional E2E Tests / E2E solidstart-2-tunnel Test (optional) Successful in 39s Details
✅ CI: Optional E2E Tests / E2E nestjs-12 (bun) Test (optional) Successful in 57s Details

@github-actions

github-actions Bot commented Nov 19, 2026 •

Copy link
Copy Markdown
Contributor

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.

Path Size % Change Change
@sentry/browser 30.23 kB - -
@sentry/browser - with treeshaking flags 28.43 kB - -
@sentry/browser - with treeshaking flags tracing without tracing 28.33 kB - -
@sentry/browser (incl. Tracing) 52.79 kB - -
@sentry/browser (incl. Tracing Core) 40.32 kB - -
@sentry/browser (incl. Tracing + Span Streaming) 52.8 kB - -
@sentry/browser (incl. Tracing, Profiling) 55.68 kB - -
@sentry/browser (incl. Tracing, Replay) 92.84 kB - -
@sentry/browser (incl. Tracing, Replay) - with treeshaking flags 81.66 kB - -
@sentry/browser (incl. Tracing, Replay with Canvas) 97.22 kB - -
@sentry/browser (incl. Tracing, Replay, Feedback) 110.76 kB - -
@sentry/browser (incl. Feedback) 48.17 kB - -
@sentry/browser (incl. sendFeedback) 30.81 kB - -
@sentry/browser (incl. FeedbackAsync) 35.84 kB - -
@sentry/browser (incl. Metrics) 31.55 kB - -
@sentry/browser (incl. Logs) 31.83 kB - -
@sentry/browser (incl. Metrics & Logs) 32.49 kB - -
@sentry/react 32.24 kB - -
@sentry/react (incl. Tracing) 55.44 kB - -
@sentry/vue 38.44 kB - -
@sentry/vue (incl. Tracing) 55.74 kB - -
@sentry/svelte 30.24 kB - -
@sentry/remix (Remix 3 client bundle) 58.45 kB - -
CDN Bundle 32.16 kB - -
CDN Bundle (incl. Tracing) 53.18 kB - -
CDN Bundle (incl. Logs, Metrics) 34.95 kB - -
CDN Bundle (incl. Tracing, Logs, Metrics) 55.74 kB - -
CDN Bundle (incl. Replay, Logs, Metrics) 75.98 kB - -
CDN Bundle (incl. Tracing, Replay) 91.06 kB - -
CDN Bundle (incl. Tracing, Replay, Logs, Metrics) 93.68 kB - -
CDN Bundle (incl. Tracing, Replay, Feedback) 96.47 kB - -
CDN Bundle (incl. Tracing, Replay, Feedback, Logs, Metrics) 99.03 kB - -
CDN Bundle - uncompressed 93.91 kB - -
CDN Bundle (incl. Tracing) - uncompressed 157.23 kB - -
CDN Bundle (incl. Logs, Metrics) - uncompressed 102.24 kB - -
CDN Bundle (incl. Tracing, Logs, Metrics) - uncompressed 164.86 kB - -
CDN Bundle (incl. Replay, Logs, Metrics) - uncompressed 232.36 kB - -
CDN Bundle (incl. Tracing, Replay) - uncompressed 277.39 kB - -
CDN Bundle (incl. Tracing, Replay, Logs, Metrics) - uncompressed 285.02 kB - -
CDN Bundle (incl. Tracing, Replay, Feedback) - uncompressed 289.32 kB - -
CDN Bundle (incl. Tracing, Replay, Feedback, Logs, Metrics) - uncompressed 296.94 kB - -
@sentry/nextjs (client) 59.13 kB - -
@sentry/sveltekit (client) 54.05 kB - -
@sentry/core/server 45.26 kB - -
@sentry/core/browser 14.4 kB - -
@sentry/node 153.73 kB -0.01% -1 B 🔽
@sentry/node/import (ESM hook with diagnostics-channel injection) 83.33 kB - -
@sentry/node - without tracing 88.8 kB - -
@sentry/node - without channel injection 142.7 kB -0.01% -1 B 🔽
@sentry/aws-serverless 99.39 kB -0.01% -4 B 🔽
@sentry/cloudflare (withSentry) - minified 208.47 kB - -
@sentry/cloudflare (withSentry) 483.72 kB - -
@sentry/cloudflare (withSentry, instrumented CommonJS package) - minified 1.02 MB - -
@sentry/nextjs/cloudflare (withSentry) - minified 233.7 kB - -

View base workflow run

@cursor cursor Bot left a comment •

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Stale Bugbot comment from a previous run.

@chargome
chargome added this pull request to stack #26635 November 19, 2026 12:29
@chargome

Copy link
Copy Markdown
Member Author

bugbot run

@cursor cursor Bot left a comment •

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Stale Bugbot comment from a previous run.

@chargome

Copy link
Copy Markdown
Member Author

bugbot run

@cursor cursor Bot left a comment •

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Stale Bugbot comment from a previous run.

@chargome
chargome marked this pull request as ready for review November 19, 2026 13:00
@chargome
chargome force-pushed the feat/solid-2-server-routes branch from a6fa935 to 7de1fab Compare November 20, 2026 08:33
@chargome

Copy link
Copy Markdown
Member Author

bugbot run

@cursor cursor Bot left a comment •

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Stale Bugbot comment from a previous run.

Base automatically changed from feat/solid-2-server to develop November 20, 2026 10:51
chargome and others added 5 commits November 20, 2026 11:51
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>
@chargome
chargome force-pushed the feat/solid-2-server-routes branch from 7de1fab to 2d43e98 Compare November 20, 2026 10:51
@chargome

Copy link
Copy Markdown
Member Author

bugbot run

@cursor cursor Bot left a comment •

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Stale Bugbot comment from a previous run.

@nicohrubec nicohrubec left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nice

}
CLIENTS_NAMING_SERVER_SPANS.add(client);

client.on('spanStart', span => {

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this approach depends on tracing being enabled iiuc, is there a way to make this work for error only setups?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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>
@chargome

ghost commented Nov 20, 2026

Copy link
Copy Markdown
Member Author

bugbot run

ghost left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

✅ 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.

@chargome
chargome merged commit 1267eac into develop Nov 20, 2026
@chargome
chargome deleted the feat/solid-2-server-routes branch November 20, 2026 12:41
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.

2 participants