Skip to content

feat(browser): Extract XHR request instrumentation into xhrTracingIntegration - #26261

Merged
logaretm merged 2 commits into
awad/long-tasks-integrationfrom
awad/xhr-tracing-integration
Nov 17, 2026
Merged

logaretm merged 2 commits into
awad/long-tasks-integrationfrom
awad/xhr-tracing-integration

Conversation

@logaretm

@logaretm logaretm commented Nov 10, 2026 •

Copy link
Copy Markdown
Member

XHR instrumentation was always bundled. this PR moves the instrumentation to a new xhrTracingIntegration, which browserTracingIntegration registers by default.

I added a test that it's registered unless traceXHR is off.

xhrTracingIntegration adds ~2.3 KB gzip on top of browserTracingCoreIntegration, or ~680 B when fetchTracingIntegration is already there, since they share the request code.

import { init, browserTracingCoreIntegration, xhrTracingIntegration } from '@sentry/browser';

init({
  integrations: [browserTracingCoreIntegration(), xhrTracingIntegration()],
});

@logaretm
logaretm added this pull request to stack #26263 November 10, 2026 16:44
@github-actions

github-actions Bot commented Nov 10, 2026 •

Copy link
Copy Markdown
Contributor

size-limit report 📦

Compared: ed36e23 (PR test merge using develop at 651378b)

Against: 4202227 (develop) · base run #66528

⚠️ Baseline mismatch: 6 develop commit(s) in the PR build are missing from the baseline. Their size changes also affect this comparison. Compare commits. Re-run once develop's baseline build for 651378b finishes.

Path Size % Change Change
@sentry/browser 30.12 kB - -
@sentry/browser - with treeshaking flags 28.32 kB - -
@sentry/browser - with treeshaking flags tracing without tracing 28.22 kB - -
@sentry/browser (incl. Tracing) 52.51 kB +0.42% +215 B 🔺
@sentry/browser (incl. Tracing + Span Streaming) 52.52 kB +0.41% +211 B 🔺
@sentry/browser (incl. Tracing, Profiling) 55.39 kB +0.24% +128 B 🔺
@sentry/browser (incl. Tracing, Replay) 92.5 kB -0.36% -333 B 🔽
@sentry/browser (incl. Tracing, Replay) - with treeshaking flags 81.36 kB -0.33% -262 B 🔽
@sentry/browser (incl. Tracing, Replay with Canvas) 96.83 kB -0.41% -396 B 🔽
@sentry/browser (incl. Tracing, Replay, Feedback) 110.09 kB -0.47% -515 B 🔽
@sentry/browser (incl. Feedback) 47.74 kB - -
@sentry/browser (incl. sendFeedback) 30.7 kB - -
@sentry/browser (incl. FeedbackAsync) 35.71 kB - -
@sentry/browser (incl. Metrics) 31.44 kB - -
@sentry/browser (incl. Logs) 31.72 kB - -
@sentry/browser (incl. Metrics & Logs) 32.38 kB - -
@sentry/react 32.13 kB - -
@sentry/react (incl. Tracing) 55.15 kB +0.34% +185 B 🔺
@sentry/vue 38.31 kB - -
@sentry/vue (incl. Tracing) 55.46 kB +0.36% +197 B 🔺
@sentry/svelte 30.13 kB - -
@sentry/remix (Remix 3 client bundle) 58.13 kB +0.11% +59 B 🔺
CDN Bundle 31.89 kB - -
CDN Bundle (incl. Tracing) 52.85 kB +0.26% +136 B 🔺
CDN Bundle (incl. Logs, Metrics) 34.68 kB - -
CDN Bundle (incl. Tracing, Logs, Metrics) 55.42 kB +0.26% +140 B 🔺
CDN Bundle (incl. Replay, Logs, Metrics) 75.72 kB - -
CDN Bundle (incl. Tracing, Replay) 90.98 kB +0.27% +240 B 🔺
CDN Bundle (incl. Tracing, Replay, Logs, Metrics) 93.59 kB +0.27% +252 B 🔺
CDN Bundle (incl. Tracing, Replay, Feedback) 96.39 kB +0.3% +285 B 🔺
CDN Bundle (incl. Tracing, Replay, Feedback, Logs, Metrics) 98.97 kB +0.27% +264 B 🔺
CDN Bundle - uncompressed 93.05 kB - -
CDN Bundle (incl. Tracing) - uncompressed 156.36 kB +0.55% +843 B 🔺
CDN Bundle (incl. Logs, Metrics) - uncompressed 101.39 kB - -
CDN Bundle (incl. Tracing, Logs, Metrics) - uncompressed 163.99 kB +0.52% +843 B 🔺
CDN Bundle (incl. Replay, Logs, Metrics) - uncompressed 231.51 kB - -
CDN Bundle (incl. Tracing, Replay) - uncompressed 276.51 kB +0.31% +843 B 🔺
CDN Bundle (incl. Tracing, Replay, Logs, Metrics) - uncompressed 284.15 kB +0.3% +843 B 🔺
CDN Bundle (incl. Tracing, Replay, Feedback) - uncompressed 288.31 kB +0.3% +843 B 🔺
CDN Bundle (incl. Tracing, Replay, Feedback, Logs, Metrics) - uncompressed 295.93 kB +0.29% +843 B 🔺
@sentry/nextjs (client) 58.8 kB +0.35% +205 B 🔺
@sentry/sveltekit (client) 53.83 kB +0.44% +235 B 🔺
@sentry/core/server 44.8 kB - -
@sentry/core/browser 14.4 kB - -
@sentry/node 151.67 kB -0.01% -6 B 🔽
@sentry/node/import (ESM hook with diagnostics-channel injection) 83.33 kB - -
@sentry/node - without tracing 88.6 kB -0.01% -2 B 🔽
@sentry/node - without channel injection 140.63 kB -0.01% -2 B 🔽
@sentry/aws-serverless 98.97 kB -0.01% -8 B 🔽
@sentry/cloudflare (withSentry) - minified 206.94 kB - -
@sentry/cloudflare (withSentry) 480.32 kB - -
@sentry/nextjs/cloudflare (withSentry) - minified 232.31 kB - -
@sentry/browser (incl. Tracing Core) 44.47 kB added added

View base workflow run

@github-actions

github-actions Bot commented Nov 10, 2026 •

Copy link
Copy Markdown
Contributor

Optional E2E tests

Some optional checks were not successful. They do not block the merge. 1 not successful, 27 successful. See the run.

Check Status
❌ CI: Optional E2E Tests / E2E nextjs-16-cacheComponents (cloudflare) Test (optional) Failing after 10m Details
Successful checks
Check Status
✅ CI: Optional E2E Tests / E2E nextjs-15 (latest) Test (optional) Successful in 3m Details
✅ CI: Optional E2E Tests / E2E nuxt-5-sourcemaps (client source maps kept) Test (optional) Successful in 43s Details
✅ CI: Optional E2E Tests / E2E nextjs-16 (vinext, bun) Test (optional) Successful in 2m Details
✅ CI: Optional E2E Tests / E2E nuxt-5-tunnel Test (optional) Successful in 48s Details
✅ CI: Optional E2E Tests / E2E nuxt-5 Test (optional) Successful in 3m Details
✅ CI: Optional E2E Tests / E2E react-send-to-sentry Test (optional) Successful in 2m Details
✅ CI: Optional E2E Tests / E2E nuxt-5-sourcemaps (static / nuxt generate) Test (optional) Successful in 42s Details
✅ CI: Optional E2E Tests / E2E tanstackstart-react-cloudflare Test (optional) Successful in 48s Details
✅ CI: Optional E2E Tests / E2E solidstart-2 Test (optional) Successful in 54s Details
✅ CI: Optional E2E Tests / E2E nextjs-orpc Test (optional) Successful in 1m Details
✅ CI: Optional E2E Tests / E2E nuxt-5-cloudflare Test (optional) Successful in 33s Details
✅ CI: Optional E2E Tests / E2E nextjs-16 (cloudflare, latest) Test (optional) Successful in 2m Details
✅ CI: Optional E2E Tests / E2E nextjs-15 (turbo) Test (optional) Successful in 2m Details
✅ CI: Optional E2E Tests / E2E tanstackstart-react (latest) Test (optional) Successful in 1m Details
✅ CI: Optional E2E Tests / E2E nuxt-5 (development) Test (optional) Successful in 1m Details
✅ CI: Optional E2E Tests / E2E nuxt-5-sourcemaps Test (optional) Successful in 40s Details
✅ CI: Optional E2E Tests / E2E astro-7 Test (optional) Successful in 1m Details
✅ CI: Optional E2E Tests / E2E astro-7-static Test (optional) Successful in 1m Details
✅ CI: Optional E2E Tests / E2E react-router-7-framework-instrumentation Test (optional) Successful in 2m Details
✅ CI: Optional E2E Tests / E2E nextjs-16-tunnel (cloudflare) Test (optional) Successful in 1m Details
✅ CI: Optional E2E Tests / E2E vue-3 (no Options API) Test (optional) Successful in 1m Details
✅ CI: Optional E2E Tests / E2E tanstackstart-react-sourcemaps Test (optional) Successful in 1m Details
✅ CI: Optional E2E Tests / E2E nextjs-16 (vinext) Test (optional) Successful in 2m Details
✅ CI: Optional E2E Tests / E2E supabase-nextjs Test (optional) Successful in 2m Details
✅ CI: Optional E2E Tests / E2E nextjs-14 (latest) Test (optional) Successful in 1m Details
✅ CI: Optional E2E Tests / E2E solidstart-2-tunnel Test (optional) Successful in 39s Details
✅ CI: Optional E2E Tests / E2E nuxt-5 (kv-cache) Test (optional) Successful in 1m Details

@logaretm

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.

@logaretm
logaretm marked this pull request as ready for review November 12, 2026 11:06
@logaretm
logaretm requested a review from a team November 12, 2026 11:07
@logaretm
logaretm requested a review from a team as a code owner November 12, 2026 11:07
@logaretm
logaretm requested a review from s1gr1d November 16, 2026 15:21
@logaretm
logaretm force-pushed the awad/xhr-tracing-integration branch from e53883b to 54e27bf Compare November 16, 2026 15:25
@logaretm
logaretm force-pushed the awad/xhr-tracing-integration branch from 54e27bf to 9c59c53 Compare November 16, 2026 15:32

@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 9c59c53. Configure here.


expect(instrumentSpy).toHaveBeenCalledTimes(calls);
});
});

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Missing integration test coverage

Low Severity

This feat PR only adds unit tests that mock instrumentXhrRequests and check registration by name. There is no integration or E2E test for the documented browserTracingCoreIntegration() plus xhrTracingIntegration() setup. Flagged because the testing conventions require at least one integration or E2E test on feat PRs.

Additional Locations (1)
Fix in Cursor Fix in Web

Triggered by project rule: PR Review Guidelines for Cursor Bot

Reviewed by Cursor Bugbot for commit 9c59c53. Configure here.

…tegration`

`browserTracingIntegration` registers it by default, so nothing changes for its users. `browserTracingCoreIntegration` only instruments fetch, so fetch-only apps can leave XHR out of their bundle.
@logaretm
logaretm force-pushed the awad/xhr-tracing-integration branch from 9c59c53 to bead391 Compare November 17, 2026 15:18
@logaretm
logaretm merged commit ff1300c into develop Nov 17, 2026
321 of 353 checks passed
@logaretm
logaretm deleted the awad/xhr-tracing-integration branch November 17, 2026 15:52
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