Skip to content

feat(remix): Propagate the server trace to Remix 3 page loads - #25145

Merged
chargome merged 5 commits into
developfrom
charlygomez/js-3889-propagate-the-server-trace-to-remix-3-page-loads
Oct 8, 2026
Merged

chargome merged 5 commits into
developfrom
charlygomez/js-3889-propagate-the-server-trace-to-remix-3-page-loads

Conversation

@chargome

@chargome chargome commented Oct 7, 2026 •

Copy link
Copy Markdown
Member

Browser page loads in Remix 3 started a new trace. The server middleware now adds sentry-trace and baggage entries to the Server-Timing header of HTML responses, ahead of the route entry, the same channel the Remix 2 SDK and Nitro use. The browser SDK already reads both off the navigation timing entry for page loads, so no client change is needed.

A response a shared cache may store (public, s-maxage, or a positive max-age without private/no-store) carries the route entry only: a cached document would otherwise hand one request's trace to every later page load, the ISR problem the Next.js SDK works around on the client.

The e2e test asserts that the page load span shares the server span's trace id and has it as parent.

Fixes #25137

Page loads started a new trace. The middleware now adds `sentry-trace`
and `baggage` entries to the `Server-Timing` header of HTML responses,
ahead of the route entry, the way the Remix 2 SDK and Nitro do. The
browser SDK already reads them off the navigation timing entry for page
loads, so no client change.

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
@chargome chargome self-assigned this Oct 7, 2026
@chargome

chargome commented Oct 7, 2026

Copy link
Copy Markdown
Member Author

bugbot run

@linear-code

linear-code Bot commented Oct 7, 2026

Copy link
Copy Markdown

JS-3889

@github-actions

github-actions Bot commented Oct 7, 2026 •

Copy link
Copy Markdown
Contributor

size-limit report 📦

Path Size % Change Change
@sentry/browser 29.8 kB - -
@sentry/browser - with treeshaking flags 27.92 kB - -
@sentry/browser - with treeshaking flags tracing without tracing 27.84 kB - -
@sentry/browser (incl. Tracing) 51.85 kB - -
@sentry/browser (incl. Tracing + Span Streaming) 51.87 kB - -
@sentry/browser (incl. Tracing, Profiling) 54.8 kB - -
@sentry/browser (incl. Tracing, Replay) 91.58 kB - -
@sentry/browser (incl. Tracing, Replay) - with treeshaking flags 80.45 kB - -
@sentry/browser (incl. Tracing, Replay with Canvas) 96.29 kB - -
@sentry/browser (incl. Tracing, Replay, Feedback) 109.27 kB - -
@sentry/browser (incl. Feedback) 47.32 kB - -
@sentry/browser (incl. sendFeedback) 34.84 kB - -
@sentry/browser (incl. FeedbackAsync) 39.95 kB - -
@sentry/browser (incl. Metrics) 30.82 kB - -
@sentry/browser (incl. Logs) 31.11 kB - -
@sentry/browser (incl. Metrics & Logs) 31.75 kB - -
@sentry/react 31.63 kB - -
@sentry/react (incl. Tracing) 54.17 kB - -
@sentry/vue 37.84 kB - -
@sentry/vue (incl. Tracing) 54.78 kB - -
@sentry/svelte 29.83 kB - -
@sentry/remix (Remix 3 client bundle) 56.83 kB - -
CDN Bundle 31.53 kB - -
CDN Bundle (incl. Tracing) 52.34 kB - -
CDN Bundle (incl. Logs, Metrics) 33.72 kB - -
CDN Bundle (incl. Tracing, Logs, Metrics) 54.3 kB - -
CDN Bundle (incl. Replay, Logs, Metrics) 74.65 kB - -
CDN Bundle (incl. Tracing, Replay) 90.01 kB - -
CDN Bundle (incl. Tracing, Replay, Logs, Metrics) 91.96 kB - -
CDN Bundle (incl. Tracing, Replay, Feedback) 96.17 kB - -
CDN Bundle (incl. Tracing, Replay, Feedback, Logs, Metrics) 98.15 kB - -
CDN Bundle - uncompressed 92.92 kB - -
CDN Bundle (incl. Tracing) - uncompressed 155.46 kB - -
CDN Bundle (incl. Logs, Metrics) - uncompressed 99.46 kB - -
CDN Bundle (incl. Tracing, Logs, Metrics) - uncompressed 161.41 kB - -
CDN Bundle (incl. Replay, Logs, Metrics) - uncompressed 229.5 kB - -
CDN Bundle (incl. Tracing, Replay) - uncompressed 275.63 kB - -
CDN Bundle (incl. Tracing, Replay, Logs, Metrics) - uncompressed 281.57 kB - -
CDN Bundle (incl. Tracing, Replay, Feedback) - uncompressed 289.33 kB - -
CDN Bundle (incl. Tracing, Replay, Feedback, Logs, Metrics) - uncompressed 295.26 kB - -
@sentry/nextjs (client) 56.53 kB - -
@sentry/sveltekit (client) 52.23 kB - -
@sentry/core/server 40.86 kB - -
@sentry/core/browser 13.71 kB - -
@sentry/node 145.89 kB +0.01% +7 B 🔺
@sentry/node/import (ESM hook with diagnostics-channel injection) 83.33 kB - -
@sentry/node - without tracing 93.69 kB +0.01% +8 B 🔺
@sentry/node - without channel injection 124.04 kB +0.01% +9 B 🔺
@sentry/aws-serverless 101.91 kB +0.01% +5 B 🔺
@sentry/cloudflare (withSentry) - minified 209.71 kB - -
@sentry/cloudflare (withSentry) 519.94 kB - -

View base workflow run

@chargome

chargome commented Oct 7, 2026

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 commented Oct 8, 2026

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 October 8, 2026 08:20
@chargome
chargome requested a review from a team as a code owner October 8, 2026 08:20
@chargome
chargome requested review from JPeer264, nicohrubec and s1gr1d and removed request for a team and s1gr1d October 8, 2026 08:20
Comment thread packages/remix/src/v3/server/middleware.ts Outdated
A shared cache would hand one request's trace to every later page load
of the cached document. A response with `public`, `s-maxage` or a
positive `max-age` and no `private`/`no-store` carries the route
entry only, which is the same for every request to it.

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
@chargome

chargome commented Oct 8, 2026

Copy link
Copy Markdown
Member Author

bugbot run

@chargome
chargome force-pushed the charlygomez/js-3889-propagate-the-server-trace-to-remix-3-page-loads branch from 007a44c to 9145130 Compare October 8, 2026 09:29
Comment thread packages/remix/test/v3/middleware.test.ts Outdated
Comment thread packages/remix/test/v3/middleware.test.ts Outdated
…test

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
@chargome

chargome commented Oct 8, 2026

Copy link
Copy Markdown
Member Author

bugbot run

Comment thread packages/remix/src/v3/server/middleware.ts

@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 commented Oct 8, 2026

Copy link
Copy Markdown
Member Author

bugbot run

@chargome
chargome enabled auto-merge (squash) October 8, 2026 11:02
Comment thread packages/remix/src/v3/server/middleware.ts

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

Comment thread packages/remix/src/v3/server/middleware.ts Outdated
Without a lifetime in `Cache-Control`, a cache falls back to `Expires`,
so a response with only a future `Expires` could still hand its trace
to later page loads.

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
@chargome

chargome commented Oct 8, 2026

Copy link
Copy Markdown
Member Author

bugbot run

@chargome
chargome force-pushed the charlygomez/js-3889-propagate-the-server-trace-to-remix-3-page-loads branch from 9218444 to 3639a3f Compare October 8, 2026 11:09
Comment thread packages/remix/src/v3/server/middleware.ts Outdated

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

Comment thread packages/remix/src/v3/server/middleware.ts
Comment thread packages/remix/src/v3/server/middleware.ts Outdated
…guard

A zero lifetime with `stale-while-revalidate` or `stale-if-error` is
still served stale by a shared cache. A CDN reads `CDN-Cache-Control`,
its vendor variants or `Surrogate-Control` instead of `Cache-Control`,
so a document can be cacheable at the CDN while private to the browser.
Any source that lets a shared cache reuse the response keeps the trace
off it.

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
@chargome

chargome commented Oct 8, 2026

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.

✅ 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 645c9dd. Configure here.

@chargome
chargome merged commit e99e6e1 into develop Oct 8, 2026
691 of 697 checks passed
@chargome
chargome deleted the charlygomez/js-3889-propagate-the-server-trace-to-remix-3-page-loads branch October 8, 2026 13:00
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.

Propagate the server trace to Remix 3 page loads

2 participants