Skip to content

Conversation

@nicohrubec
Copy link
Member

@nicohrubec nicohrubec commented Dec 17, 2025

This PR adds tracing for tss server routes (and other http server requests), by extending the implementation in the existing wrapFetchWithSentry wrapper.

Screenshot from my sample app for a server route request:
Screenshot 2025-12-17 at 15 47 32

Tests added:

  • E2E: Basic transaction test to verify that we get spans if a server route is executed.

Closes #18284

@nicohrubec nicohrubec self-assigned this Dec 17, 2025
@github-actions
Copy link
Contributor

github-actions bot commented Dec 17, 2025

size-limit report 📦

Path Size % Change Change
@sentry/browser 24.81 kB - -
@sentry/browser - with treeshaking flags 23.3 kB - -
@sentry/browser (incl. Tracing) 41.58 kB - -
@sentry/browser (incl. Tracing, Profiling) 46.18 kB - -
@sentry/browser (incl. Tracing, Replay) 80.16 kB - -
@sentry/browser (incl. Tracing, Replay) - with treeshaking flags 69.9 kB - -
@sentry/browser (incl. Tracing, Replay with Canvas) 84.85 kB - -
@sentry/browser (incl. Tracing, Replay, Feedback) 97.08 kB - -
@sentry/browser (incl. Feedback) 41.52 kB - -
@sentry/browser (incl. sendFeedback) 29.49 kB - -
@sentry/browser (incl. FeedbackAsync) 34.48 kB - -
@sentry/react 26.52 kB - -
@sentry/react (incl. Tracing) 43.78 kB - -
@sentry/vue 29.27 kB - -
@sentry/vue (incl. Tracing) 43.39 kB - -
@sentry/svelte 24.82 kB - -
CDN Bundle 27.23 kB - -
CDN Bundle (incl. Tracing) 42.22 kB - -
CDN Bundle (incl. Tracing, Replay) 78.93 kB - -
CDN Bundle (incl. Tracing, Replay, Feedback) 84.39 kB - -
CDN Bundle - uncompressed 80.02 kB - -
CDN Bundle (incl. Tracing) - uncompressed 125.37 kB - -
CDN Bundle (incl. Tracing, Replay) - uncompressed 241.91 kB - -
CDN Bundle (incl. Tracing, Replay, Feedback) - uncompressed 254.67 kB - -
@sentry/nextjs (client) 46 kB - -
@sentry/sveltekit (client) 41.95 kB - -
@sentry/node-core 51.6 kB - -
@sentry/node 161.48 kB - -
@sentry/node - without tracing 93.03 kB - -
@sentry/aws-serverless 108.54 kB - -

View base workflow run

@nicohrubec nicohrubec marked this pull request as ready for review December 17, 2025 14:52
return target.apply(thisArg, args);
},
);
},
Copy link

Choose a reason for hiding this comment

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

Bug: Nested http.server spans duplicate root spans

Wrapping every serverEntry.fetch call in startSpan with op = 'http.server' creates a child http.server span when an incoming-request transaction is already active (e.g., from Node HTTP auto-instrumentation). This can produce duplicate http.server spans in a single trace and misleading timings/attributes because the inner span ends when the handler returns, not when the response finishes.

Fix in Cursor Fix in Web

);
} else {
// API route or other server request
op = 'http.server';
Copy link
Member Author

Choose a reason for hiding this comment

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

Not sure if this is the correct op or if we should use something tanstack specific here

@andreiborza
Copy link
Member

As discussed offline: At the moment, these add no value on top of the base http spans we are getting from the http integration. I'd suggest to wait with this until it's clearer how we can parametrize routes and then probably instead of starting a span, we'd probably want to update the name of the http span.

@nicohrubec
Copy link
Member Author

Pushing this back until we have figured if we can get parametrized routes, closing for now.

@nicohrubec nicohrubec closed this Dec 18, 2025
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.

Server routing tracing

3 participants