Skip to content

ref(browser): Restructure browser-utils by domain - #23071

Merged
logaretm merged 1 commit into
awad/webvitals-dep-onlyfrom
awad/webvitals-restructure
Aug 7, 2026
Merged

ref(browser): Restructure browser-utils by domain#23071
logaretm merged 1 commit into
awad/webvitals-dep-onlyfrom
awad/webvitals-restructure

Conversation

@logaretm

@logaretm logaretm commented Aug 5, 2026

Copy link
Copy Markdown
Member

Reorganizes browser-utils/src away from the catch-all metrics/ folder into clear domains: instrumentation/ (dom/history/location/xhr + the PerformanceObserver layer), web-vitals/ (tracking, spans, inp, lcp, reportEvents, and the helpers merged into one utils), and performance/ (entries, element/user/resource timing, shared utils).

The reasoning is we will actually have some metric emitting logic in there and we don't want it to be confused with pre-existing logic like in #22397

Following up on pulling in webvitals as a dependency, I took this chance to clean up our structure and it does have some minor bundle-size improvements. The bundle increases are due to #23070 which explains where the increase is coming from and why we are willing to absorb it.

@logaretm
logaretm force-pushed the awad/webvitals-restructure branch from af2fd8a to cc6aaf8 Compare August 5, 2026 16:47
@github-actions

github-actions Bot commented Aug 5, 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 30.33 kB -0.04% -11 B 🔽
@sentry/browser - with treeshaking flags 28.54 kB -0.04% -9 B 🔽
@sentry/browser - with treeshaking flags tracing without tracing 26.86 kB -0.03% -6 B 🔽
@sentry/browser (incl. Tracing) 49.08 kB +2.67% +1.28 kB 🔺
@sentry/browser (incl. Tracing + Span Streaming) 49.1 kB +2.68% +1.28 kB 🔺
@sentry/browser (incl. Tracing, Profiling) 53.88 kB +2.53% +1.32 kB 🔺
@sentry/browser (incl. Tracing, Replay) 88.43 kB +1.43% +1.24 kB 🔺
@sentry/browser (incl. Tracing, Replay) - with treeshaking flags 77.83 kB +1.59% +1.22 kB 🔺
@sentry/browser (incl. Tracing, Replay with Canvas) 93.12 kB +1.32% +1.21 kB 🔺
@sentry/browser (incl. Tracing, Replay, Feedback) 105.81 kB +1.2% +1.25 kB 🔺
@sentry/browser (incl. Feedback) 47.67 kB -0.02% -7 B 🔽
@sentry/browser (incl. sendFeedback) 35.16 kB -0.04% -11 B 🔽
@sentry/browser (incl. FeedbackAsync) 40.33 kB -0.02% -8 B 🔽
@sentry/browser (incl. Metrics) 31.4 kB -0.03% -9 B 🔽
@sentry/browser (incl. Logs) 31.65 kB -0.04% -10 B 🔽
@sentry/browser (incl. Metrics & Logs) 32.31 kB -0.03% -9 B 🔽
@sentry/react 32.14 kB -0.03% -9 B 🔽
@sentry/react (incl. Tracing) 51.27 kB +2.41% +1.2 kB 🔺
@sentry/vue 35.44 kB -0.03% -10 B 🔽
@sentry/vue (incl. Tracing) 51.05 kB +2.47% +1.23 kB 🔺
@sentry/svelte 30.36 kB -0.04% -11 B 🔽
CDN Bundle 32.34 kB +0.01% +2 B 🔺
CDN Bundle (incl. Tracing) 49.66 kB +3.18% +1.53 kB 🔺
CDN Bundle (incl. Logs, Metrics) 33.87 kB -0.04% -11 B 🔽
CDN Bundle (incl. Tracing, Logs, Metrics) 50.97 kB +3.05% +1.51 kB 🔺
CDN Bundle (incl. Replay, Logs, Metrics) 74.4 kB +1.61% +1.17 kB 🔺
CDN Bundle (incl. Tracing, Replay) 87.19 kB +1.7% +1.45 kB 🔺
CDN Bundle (incl. Tracing, Replay, Logs, Metrics) 88.47 kB +1.67% +1.45 kB 🔺
CDN Bundle (incl. Tracing, Replay, Feedback) 93.07 kB +1.66% +1.51 kB 🔺
CDN Bundle (incl. Tracing, Replay, Feedback, Logs, Metrics) 94.33 kB +1.59% +1.47 kB 🔺
CDN Bundle - uncompressed 95.88 kB +0.01% +2 B 🔺
CDN Bundle (incl. Tracing) - uncompressed 148.98 kB +3.77% +5.4 kB 🔺
CDN Bundle (incl. Logs, Metrics) - uncompressed 100.47 kB -0.04% -34 B 🔽
CDN Bundle (incl. Tracing, Logs, Metrics) - uncompressed 152.96 kB +3.66% +5.4 kB 🔺
CDN Bundle (incl. Replay, Logs, Metrics) - uncompressed 229.39 kB +1.87% +4.2 kB 🔺
CDN Bundle (incl. Tracing, Replay) - uncompressed 268.24 kB +2.06% +5.4 kB 🔺
CDN Bundle (incl. Tracing, Replay, Logs, Metrics) - uncompressed 272.2 kB +2.03% +5.4 kB 🔺
CDN Bundle (incl. Tracing, Replay, Feedback) - uncompressed 281.94 kB +1.95% +5.39 kB 🔺
CDN Bundle (incl. Tracing, Replay, Feedback, Logs, Metrics) - uncompressed 285.89 kB +1.93% +5.39 kB 🔺
@sentry/nextjs (client) 53.83 kB +2.3% +1.21 kB 🔺
@sentry/sveltekit (client) 49.47 kB +2.5% +1.2 kB 🔺
@sentry/core/server 65.77 kB - -
@sentry/core/browser 52 kB - -
@sentry/node 119.43 kB - -
@sentry/node/import (ESM hook with diagnostics-channel injection) 0 B added added
@sentry/node - without tracing 83.42 kB - -
@sentry/aws-serverless 92.74 kB - -
@sentry/cloudflare (withSentry) - minified 214.89 kB - -
@sentry/cloudflare (withSentry) 530.77 kB - -

View base workflow run

@logaretm
logaretm force-pushed the awad/webvitals-restructure branch from cc6aaf8 to 071799f Compare August 5, 2026 17:35
@logaretm
logaretm force-pushed the awad/webvitals-restructure branch 2 times, most recently from e1990b4 to 794433e Compare August 5, 2026 19:00
@logaretm
logaretm force-pushed the awad/webvitals-restructure branch from 794433e to 7a246f5 Compare August 5, 2026 19:16
@logaretm
logaretm force-pushed the awad/webvitals-restructure branch from 7a246f5 to 12d0fc5 Compare August 5, 2026 19:44
@logaretm
logaretm marked this pull request as ready for review August 5, 2026 20:05
@logaretm
logaretm requested a review from a team as a code owner August 5, 2026 20:05
@logaretm
logaretm requested review from Lms24 and msonnb and removed request for a team August 5, 2026 20:05
Comment thread packages/browser-utils/src/web-vitals/utils.ts
@logaretm
logaretm force-pushed the awad/webvitals-restructure branch from 12d0fc5 to 7c1f6aa Compare August 6, 2026 14:06
Comment thread packages/browser-utils/src/web-vitals/reportEvents.ts
Reorganize browser-utils/src away from the catch-all metrics/ folder into
clear domains:

- instrumentation/ for event-source hooks (dom, history, location, xhr) plus
  the PerformanceObserver layer, renamed from metrics/instrument.ts to
  instrumentation/performanceObserver.ts to stop colliding with the folder
- web-vitals/ for web-vital tracking, spans, inp, lcp, reportEvents, and the
  browser helpers merged into a single utils.ts
- performance/ for generic performance-entry enrichment: entries, element/
  user/resource timing, and shared utils

browserMetrics.ts is split into web-vitals/tracking.ts and performance/
entries.ts, and utils.ts into web-vitals/reportEvents.ts and performance/
utils.ts. Public API (index.ts re-exports) is unchanged; only internal paths
and the test tree move.
@logaretm
logaretm force-pushed the awad/webvitals-restructure branch from 7c1f6aa to 8c7cea8 Compare August 7, 2026 14:39

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

nice, this looks much more logical now, thanks!

@logaretm
logaretm merged commit 9e4e43d into develop Aug 7, 2026
198 checks passed
@logaretm
logaretm deleted the awad/webvitals-restructure branch August 7, 2026 15:19
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