Skip to content

feat(tanstackstart-react): Emit low-cardinality names for function spans - #24568

Merged
Lms24 merged 3 commits into
developfrom
fix/tanstackstart-function-span-names
Sep 23, 2026
Merged

Lms24 merged 3 commits into
developfrom
fix/tanstackstart-function-span-names

Conversation

@Lms24

@Lms24 Lms24 commented Sep 21, 2026

Copy link
Copy Markdown
Member

The server function span was named after the request path, which carries TanStack's generated server-function id, so every server function produced an unbounded set of span names under span streaming. It is now named after the function it wraps: serverFn at start, and the server function's own name once the global function middleware resolves it.

Two knock-on changes worth a look: that middleware used to recover the request method by splitting the span name, which no longer contains one, so it reads http.request.method off the span instead (newly set at the start site). And since the function op's description template is {{code.function.name}} alone, Relay cannot infer the request path back — the previous name is kept on sentry.description, streaming branch only.

🤖 Generated with Claude Code

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

Cursor Bugbot has reviewed your changes and found 1 potential issue.

Fix All in Cursor

❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.

Reviewed by Cursor Bugbot for commit 155db83. Configure here.

Comment thread packages/tanstackstart-react/src/server/globalMiddleware.ts
@github-actions

github-actions Bot commented Sep 21, 2026

Copy link
Copy Markdown
Contributor

size-limit report 📦

⚠️ Warning: Base artifact is not the latest one, because the latest workflow run is not done yet. This may lead to incorrect results. Try to re-run all tests to get up to date results.

Path Size % Change Change
@sentry/browser 29.23 kB - -
@sentry/browser - with treeshaking flags 27.5 kB - -
@sentry/browser - with treeshaking flags tracing without tracing 27.4 kB - -
@sentry/browser (incl. Tracing) 51.16 kB - -
@sentry/browser (incl. Tracing + Span Streaming) 51.17 kB - -
@sentry/browser (incl. Tracing, Profiling) 54.16 kB - -
@sentry/browser (incl. Tracing, Replay) 90.75 kB - -
@sentry/browser (incl. Tracing, Replay) - with treeshaking flags 79.85 kB - -
@sentry/browser (incl. Tracing, Replay with Canvas) 95.45 kB - -
@sentry/browser (incl. Tracing, Replay, Feedback) 108.42 kB - -
@sentry/browser (incl. Feedback) 46.76 kB - -
@sentry/browser (incl. sendFeedback) 34.29 kB - -
@sentry/browser (incl. FeedbackAsync) 39.39 kB - -
@sentry/browser (incl. Metrics) 30.25 kB - -
@sentry/browser (incl. Logs) 30.5 kB - -
@sentry/browser (incl. Metrics & Logs) 31.17 kB - -
@sentry/react 30.98 kB - -
@sentry/react (incl. Tracing) 53.44 kB - -
@sentry/vue 36.72 kB - -
@sentry/vue (incl. Tracing) 53.69 kB - -
@sentry/svelte 29.25 kB - -
CDN Bundle 30.93 kB - -
CDN Bundle (incl. Tracing) 51.69 kB - -
CDN Bundle (incl. Logs, Metrics) 33.19 kB - -
CDN Bundle (incl. Tracing, Logs, Metrics) 53.66 kB - -
CDN Bundle (incl. Replay, Logs, Metrics) 73.92 kB - -
CDN Bundle (incl. Tracing, Replay) 89.27 kB - -
CDN Bundle (incl. Tracing, Replay, Logs, Metrics) 91.23 kB - -
CDN Bundle (incl. Tracing, Replay, Feedback) 95.43 kB - -
CDN Bundle (incl. Tracing, Replay, Feedback, Logs, Metrics) 97.4 kB - -
CDN Bundle - uncompressed 91.4 kB - -
CDN Bundle (incl. Tracing) - uncompressed 153.76 kB - -
CDN Bundle (incl. Logs, Metrics) - uncompressed 97.97 kB - -
CDN Bundle (incl. Tracing, Logs, Metrics) - uncompressed 159.72 kB - -
CDN Bundle (incl. Replay, Logs, Metrics) - uncompressed 227.54 kB - -
CDN Bundle (incl. Tracing, Replay) - uncompressed 273.5 kB - -
CDN Bundle (incl. Tracing, Replay, Logs, Metrics) - uncompressed 279.43 kB - -
CDN Bundle (incl. Tracing, Replay, Feedback) - uncompressed 287.2 kB - -
CDN Bundle (incl. Tracing, Replay, Feedback, Logs, Metrics) - uncompressed 293.13 kB - -
@sentry/nextjs (client) 55.78 kB - -
@sentry/sveltekit (client) 51.59 kB - -
@sentry/core/server 39.92 kB - -
@sentry/core/browser 13.63 kB - -
@sentry/node 133.88 kB +0.02% +16 B 🔺
@sentry/node/import (ESM hook with diagnostics-channel injection) 82.4 kB - -
@sentry/node - without tracing 90.39 kB +0.01% +7 B 🔺
@sentry/node - without channel injection 112.42 kB +0.02% +21 B 🔺
@sentry/aws-serverless 98.71 kB +0.03% +22 B 🔺
@sentry/cloudflare (withSentry) - minified 206.34 kB - -
@sentry/cloudflare (withSentry) 513.42 kB - -

View base workflow run

@Lms24 Lms24 self-assigned this Sep 22, 2026
@Lms24
Lms24 marked this pull request as ready for review September 22, 2026 12:27
@Lms24
Lms24 requested a review from a team as a code owner September 22, 2026 12:27
@Lms24
Lms24 requested review from nicohrubec and s1gr1d and removed request for a team September 22, 2026 12:27

@JPeer264 JPeer264 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.

LGTM.

@Lms24
Lms24 force-pushed the fix/tanstackstart-function-span-names branch 2 times, most recently from c776409 to 275b85b Compare September 23, 2026 07:00
Lms24 and others added 3 commits September 23, 2026 09:17
The server function span was named after the request path, which carries
the server function's generated id, so every server function produced an
unbounded set of span names under span streaming.

Name the span after the function it wraps: `serverFn` at start, and the
server function's own name once the global function middleware resolves
it. That middleware derived the request method by splitting the span
name, which no longer holds a method, so it now reads `http.request.method`
off the span instead. Since the `function` op's description template is
`{{code.function.name}}` and nothing else, Relay cannot infer the request
path - the previous name is kept on `sentry.description`.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
…cycles

The span starts with a `serverFn` placeholder because the function's name
is not known until the global function middleware runs. That middleware
only replaced the placeholder under span streaming, so static-lifecycle
spans kept `serverFn` even though the real name was available.

Resolve the attribute in both lifecycles and gate only `sentry.description`,
which exists solely to carry the request path past Relay's streaming
description template. This matches the ember and sveltekit `function` spans,
which both set `code.function.name` unconditionally.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
…span attributes

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
@Lms24
Lms24 force-pushed the fix/tanstackstart-function-span-names branch from 275b85b to 7e07d34 Compare September 23, 2026 07:17
@Lms24 Lms24 changed the title fix(tanstackstart-react): Use low-cardinality names for function spans feat(tanstackstart-react): Emit low-cardinality names for function spans Sep 23, 2026
@Lms24
Lms24 merged commit 6a99951 into develop Sep 23, 2026
48 checks passed
@Lms24
Lms24 deleted the fix/tanstackstart-function-span-names branch September 23, 2026 07:26
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.

3 participants