Skip to content

feat(tanstackstart-react): Add distributed tracing#21144

Draft
nicohrubec wants to merge 6 commits into
developfrom
feat/tanstack-start-distributed-tracing
Draft

feat(tanstackstart-react): Add distributed tracing#21144
nicohrubec wants to merge 6 commits into
developfrom
feat/tanstack-start-distributed-tracing

Conversation

@nicohrubec
Copy link
Copy Markdown
Member

@nicohrubec nicohrubec commented May 23, 2026

Adds distributed tracing to the TanStack Start SDK by injecting sentry-trace and baggage meta tags into HTML responses in wrapFetchWithSentry. This connects server and client traces automatically without requiring any additional user setup.

The added functions that do the meta tag injections are essentially copies from the astro package (addMetaTagToHead, injectMetaTagsInResponse).

Added a trace-propagation test to the main TSS e2e test application and adjusted the existing cloudflare TSS e2e test application to the new pattern (i.e. remove the manual injection of meta tags).

Example trace with my local sample app:
Screenshot 2026-05-23 at 16 40 05

Closes #18286

nicohrubec and others added 3 commits May 23, 2026 15:40
…tion

Adds distributed tracing to the TanStack Start SDK by injecting `sentry-trace` and `baggage` meta tags into HTML responses in `wrapFetchWithSentry`, connecting server and client traces automatically.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Restore bodyIterator generator for stream error reporting, captureException
in outer catch, TS narrowing reassignment, and comments.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Comment thread packages/tanstackstart-react/src/server/wrapFetchWithSentry.ts Outdated
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Comment thread packages/tanstackstart-react/src/server/wrapFetchWithSentry.ts
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Copy link
Copy Markdown

@cursor cursor Bot left a comment

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 2 potential issues.

There are 3 total unresolved issues (including 1 from previous review).

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 99207fb. Configure here.

Comment thread packages/tanstackstart-react/src/server/wrapFetchWithSentry.ts
Comment thread packages/tanstackstart-react/src/server/wrapFetchWithSentry.ts
@nicohrubec nicohrubec changed the title feat(tanstackstart-react): Add distributed tracing via meta tag injection feat(tanstackstart-react): Add distributed tracing May 23, 2026
Closing an already-errored ReadableStream controller throws TypeError.
Track error state and skip close() in that case.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
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.

Support distributed tracing

1 participant