Skip to content

feat(browser): Extract long task and LoAF tracking into longTasksIntegration - #26260

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

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

Conversation

@logaretm

@logaretm logaretm commented Nov 10, 2026 •

Copy link
Copy Markdown
Member

Long task and LoAF tracking was always bundled with browser tracing. This PR moves the logic to a new longTasksIntegration, which browserTracingIntegration registers by default.

I added a test that it's registered unless both long task options are off.

longTasksIntegration adds ~742 B gzip on top of browserTracingCoreIntegration.

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

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

@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: 651378b (PR test merge using develop at 1423338)

Against: 4202227 (develop) · base run #66528

⚠️ Baseline mismatch: 3 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 1423338 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.38 kB +0.17% +84 B 🔺
@sentry/browser (incl. Tracing + Span Streaming) 52.39 kB +0.17% +86 B 🔺
@sentry/browser (incl. Tracing, Profiling) 55.27 kB +0.02% +9 B 🔺
@sentry/browser (incl. Tracing, Replay) 92.37 kB -0.5% -456 B 🔽
@sentry/browser (incl. Tracing, Replay) - with treeshaking flags 81.22 kB -0.5% -400 B 🔽
@sentry/browser (incl. Tracing, Replay with Canvas) 96.72 kB -0.52% -504 B 🔽
@sentry/browser (incl. Tracing, Replay, Feedback) 109.93 kB -0.61% -674 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.05 kB +0.16% +87 B 🔺
@sentry/vue 38.31 kB - -
@sentry/vue (incl. Tracing) 55.35 kB +0.18% +94 B 🔺
@sentry/svelte 30.13 kB - -
@sentry/remix (Remix 3 client bundle) 58.14 kB +0.12% +69 B 🔺
CDN Bundle 31.89 kB - -
CDN Bundle (incl. Tracing) 52.77 kB +0.1% +48 B 🔺
CDN Bundle (incl. Logs, Metrics) 34.68 kB - -
CDN Bundle (incl. Tracing, Logs, Metrics) 55.33 kB +0.09% +47 B 🔺
CDN Bundle (incl. Replay, Logs, Metrics) 75.72 kB - -
CDN Bundle (incl. Tracing, Replay) 90.79 kB +0.07% +57 B 🔺
CDN Bundle (incl. Tracing, Replay, Logs, Metrics) 93.41 kB +0.08% +74 B 🔺
CDN Bundle (incl. Tracing, Replay, Feedback) 96.2 kB +0.1% +90 B 🔺
CDN Bundle (incl. Tracing, Replay, Feedback, Logs, Metrics) 98.79 kB +0.1% +91 B 🔺
CDN Bundle - uncompressed 93.05 kB - -
CDN Bundle (incl. Tracing) - uncompressed 155.74 kB +0.15% +219 B 🔺
CDN Bundle (incl. Logs, Metrics) - uncompressed 101.39 kB - -
CDN Bundle (incl. Tracing, Logs, Metrics) - uncompressed 163.37 kB +0.14% +219 B 🔺
CDN Bundle (incl. Replay, Logs, Metrics) - uncompressed 231.51 kB - -
CDN Bundle (incl. Tracing, Replay) - uncompressed 275.89 kB +0.08% +219 B 🔺
CDN Bundle (incl. Tracing, Replay, Logs, Metrics) - uncompressed 283.52 kB +0.08% +219 B 🔺
CDN Bundle (incl. Tracing, Replay, Feedback) - uncompressed 287.69 kB +0.08% +219 B 🔺
CDN Bundle (incl. Tracing, Replay, Feedback, Logs, Metrics) - uncompressed 295.31 kB +0.08% +219 B 🔺
@sentry/nextjs (client) 58.67 kB +0.15% +83 B 🔺
@sentry/sveltekit (client) 53.67 kB +0.15% +79 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% -1 B 🔽
@sentry/aws-serverless 98.97 kB -0.01% -7 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) 45.05 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 (kv-cache) 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 vue-3 (no Options API) Test (optional) Successful in 1m Details
✅ CI: Optional E2E Tests / E2E nuxt-5-cloudflare Test (optional) Successful in 46s Details
✅ CI: Optional E2E Tests / E2E nextjs-16 (vinext, bun) 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 nextjs-16 (vinext) Test (optional) Successful in 1m Details
✅ CI: Optional E2E Tests / E2E tanstackstart-react-sourcemaps Test (optional) Successful in 40s Details
✅ CI: Optional E2E Tests / E2E astro-7-static Test (optional) Successful in 1m Details
✅ CI: Optional E2E Tests / E2E nuxt-5-sourcemaps (static / nuxt generate) Test (optional) Successful in 1m Details
✅ CI: Optional E2E Tests / E2E nextjs-16 (cloudflare, latest) Test (optional) Successful in 2m Details
✅ CI: Optional E2E Tests / E2E nextjs-16-tunnel (cloudflare) Test (optional) Successful in 58s Details
✅ CI: Optional E2E Tests / E2E astro-7 Test (optional) Successful in 1m Details
✅ CI: Optional E2E Tests / E2E nuxt-5-sourcemaps Test (optional) Successful in 41s Details
✅ CI: Optional E2E Tests / E2E nextjs-14 (latest) Test (optional) Successful in 1m Details
✅ CI: Optional E2E Tests / E2E tanstackstart-react (latest) Test (optional) Successful in 1m Details
✅ CI: Optional E2E Tests / E2E solidstart-2-tunnel Test (optional) Successful in 55s Details
✅ CI: Optional E2E Tests / E2E nextjs-orpc Test (optional) Successful in 1m Details
✅ CI: Optional E2E Tests / E2E nuxt-5-sourcemaps (client source maps kept) Test (optional) Successful in 35s Details
✅ CI: Optional E2E Tests / E2E supabase-nextjs Test (optional) Successful in 2m Details
✅ CI: Optional E2E Tests / E2E react-send-to-sentry Test (optional) Successful in 3m Details
✅ CI: Optional E2E Tests / E2E nuxt-5 Test (optional) Successful in 2m Details
✅ CI: Optional E2E Tests / E2E react-router-7-framework-instrumentation Test (optional) Successful in 2m Details
✅ CI: Optional E2E Tests / E2E nuxt-5-tunnel Test (optional) Successful in 58s Details
✅ CI: Optional E2E Tests / E2E solidstart-2 Test (optional) Successful in 51s Details
✅ CI: Optional E2E Tests / E2E tanstackstart-react-cloudflare Test (optional) Successful in 41s Details

@logaretm
logaretm force-pushed the awad/long-tasks-integration branch 2 times, most recently from 1091699 to b151846 Compare November 11, 2026 09:05
@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:05
@logaretm
logaretm requested a review from a team November 12, 2026 11:05
@logaretm
logaretm requested a review from a team as a code owner November 12, 2026 11:05
@logaretm
logaretm force-pushed the awad/long-tasks-integration branch from b151846 to 23fbb27 Compare November 16, 2026 15:25

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


// oxlint-disable-next-line typescript/no-deprecated -- still honoured until it is removed
const { enableInp = true, webVitals } = options;
const { enableInp = true, webVitals, enableLongTask = true, enableLongAnimationFrame = true } = options;

@msonnb msonnb Nov 17, 2026 •

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.

these default to true now when they're explicitly set to undefined whereas before, we ...spread them, leaving them at undefined. idk if it's a huge concern, and it might even make more sense to say "undefined == default behavior".

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

Yea we don't want to change the semantics here, thanks for catching this!

…egration`

`browserTracingIntegration` registers it by default, so nothing changes for its users. `browserTracingCoreIntegration` users only bundle it when they add it.
@logaretm
logaretm force-pushed the awad/long-tasks-integration branch from 9bd4d53 to 33f13a0 Compare November 17, 2026 15:18

@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 33f13a0. Configure here.

const INTEGRATION_NAME = 'LongTasks';

const _longTasksIntegration = ((options: LongTasksOptions = {}) => {
const { enableLongTask = true, enableLongAnimationFrame = true } = options;

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Undefined flags re-enable tracking

Low Severity

DEFAULT_FORWARDED_OPTIONS is spread so an explicit undefined for enableLongTask or enableLongAnimationFrame stays undefined, matching the old falsy behavior. Those values are then passed into longTasksIntegration, whose destructuring defaults turn undefined back into true. A mixed setting such as enableLongAnimationFrame: undefined with enableLongTask left at the default therefore tracks LoAF again instead of falling through to long tasks.

Additional Locations (1)
Fix in Cursor Fix in Web

Reviewed by Cursor Bugbot for commit 33f13a0. Configure here.

@logaretm
logaretm merged commit f9451b9 into develop Nov 17, 2026
321 of 354 checks passed
@logaretm
logaretm deleted the awad/long-tasks-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.

3 participants