Skip to content

feat(browser): Report web vitals for bfcache restores - #23750

Draft
logaretm wants to merge 1 commit into
awad/bfcache-navigation-spanfrom
awad/bfcache-web-vitals
Draft

feat(browser): Report web vitals for bfcache restores#23750
logaretm wants to merge 1 commit into
awad/bfcache-navigation-spanfrom
awad/bfcache-web-vitals

Conversation

@logaretm

@logaretm logaretm commented Aug 28, 2026

Copy link
Copy Markdown
Member

Reports web vitals for back/forward cache restores, which we dropped outright before.

Now that a restore gets its own navigation span in #23748, the vitals have a correct parent, so the hardcoded withoutBfcache drop becomes webVitals: { bfcache: true }. Off by default, since a restore is a different population from a page load.

Stacked on #23748.

@logaretm logaretm changed the title awad/bfcache web vitals feat(browser): Report web vitals for bfcache restores Aug 28, 2026
… dropped

`withoutBfcache` dropped every metric web-vitals reported after a
back/forward-cache restore. That was the right call while there was
nothing to attach them to: a restore reuses the frozen document, so the
values would have landed on the span the page had before it was frozen.

Now that a restore gets its own navigation span, they have a correct
parent, so the drop becomes an option rather than a hard rule:

    webVitals: { bfcache: true }

Off by default. A restore is near-instant, so its vitals are a different
population from page load vitals, and the earlier concern about skewing
aggregates still applies to anyone who has not decided how to treat them.
`browser.navigation.type: bfcache` makes them separable once enabled.

Reporting per navigation rather than per page load is now what the
tracker flag means, since bfcache restores need it for the same reason
soft navigations do. `reportAllChanges` is switched off for either, since
the per-navigation path relies on each reported value already being final
for its navigation.

Verified end to end in Chrome 152: a restore emits LCP and CLS parented
to the bfcache navigation span on the restore's own trace, and a
bfcache-ineligible back navigation still falls back to a page load.
@logaretm
logaretm force-pushed the awad/bfcache-web-vitals branch from c306449 to b172bce Compare August 31, 2026 16:03
@github-actions

Copy link
Copy Markdown
Contributor

size-limit report 📦

Path Size % Change Change
@sentry/browser 28.56 kB - -
@sentry/browser - with treeshaking flags 26.92 kB - -
@sentry/browser - with treeshaking flags tracing without tracing 26.82 kB - -
@sentry/browser (incl. Tracing) 49.78 kB +2.12% +1.03 kB 🔺
@sentry/browser (incl. Tracing + Span Streaming) 49.8 kB +2.13% +1.03 kB 🔺
@sentry/browser (incl. Tracing, Profiling) 52.77 kB +2.13% +1.1 kB 🔺
@sentry/browser (incl. Tracing, Replay) 89.29 kB +1.2% +1.06 kB 🔺
@sentry/browser (incl. Tracing, Replay) - with treeshaking flags 78.57 kB +1.22% +943 B 🔺
@sentry/browser (incl. Tracing, Replay with Canvas) 93.97 kB +1.13% +1.04 kB 🔺
@sentry/browser (incl. Tracing, Replay, Feedback) 106.94 kB +1.03% +1.09 kB 🔺
@sentry/browser (incl. Feedback) 46.05 kB - -
@sentry/browser (incl. sendFeedback) 33.62 kB - -
@sentry/browser (incl. FeedbackAsync) 38.73 kB - -
@sentry/browser (incl. Metrics) 29.51 kB - -
@sentry/browser (incl. Logs) 29.8 kB - -
@sentry/browser (incl. Metrics & Logs) 30.43 kB - -
@sentry/react 30.3 kB - -
@sentry/react (incl. Tracing) 51.95 kB +1.99% +1.01 kB 🔺
@sentry/vue 35.73 kB - -
@sentry/vue (incl. Tracing) 52.01 kB +1.95% +990 B 🔺
@sentry/svelte 28.59 kB - -
CDN Bundle 30.35 kB - -
CDN Bundle (incl. Tracing) 50.35 kB +1.97% +968 B 🔺
CDN Bundle (incl. Logs, Metrics) 32.58 kB - -
CDN Bundle (incl. Tracing, Logs, Metrics) 52.23 kB +1.91% +974 B 🔺
CDN Bundle (incl. Replay, Logs, Metrics) 73.21 kB +0.05% +33 B 🔺
CDN Bundle (incl. Tracing, Replay) 87.84 kB +1.13% +976 B 🔺
CDN Bundle (incl. Tracing, Replay, Logs, Metrics) 89.72 kB +1.12% +992 B 🔺
CDN Bundle (incl. Tracing, Replay, Feedback) 93.85 kB +1.14% +1.05 kB 🔺
CDN Bundle (incl. Tracing, Replay, Feedback, Logs, Metrics) 95.79 kB +1.21% +1.15 kB 🔺
CDN Bundle - uncompressed 89.95 kB - -
CDN Bundle (incl. Tracing) - uncompressed 150.6 kB +2.32% +3.41 kB 🔺
CDN Bundle (incl. Logs, Metrics) - uncompressed 96.24 kB - -
CDN Bundle (incl. Tracing, Logs, Metrics) - uncompressed 156.29 kB +2.23% +3.41 kB 🔺
CDN Bundle (incl. Replay, Logs, Metrics) - uncompressed 225.52 kB +0.05% +107 B 🔺
CDN Bundle (incl. Tracing, Replay) - uncompressed 270.08 kB +1.28% +3.39 kB 🔺
CDN Bundle (incl. Tracing, Replay, Logs, Metrics) - uncompressed 275.76 kB +1.25% +3.39 kB 🔺
CDN Bundle (incl. Tracing, Replay, Feedback) - uncompressed 283.79 kB +1.21% +3.39 kB 🔺
CDN Bundle (incl. Tracing, Replay, Feedback, Logs, Metrics) - uncompressed 289.45 kB +1.19% +3.39 kB 🔺
@sentry/nextjs (client) 54.45 kB +1.67% +893 B 🔺
@sentry/sveltekit (client) 50.19 kB +2.03% +998 B 🔺
@sentry/core/server 65.67 kB - -
@sentry/core/browser 51.86 kB - -
@sentry/node 123.77 kB +0.02% +19 B 🔺
@sentry/node/import (ESM hook with diagnostics-channel injection) 85.53 kB - -
@sentry/node - without tracing 88.03 kB +0.02% +14 B 🔺
@sentry/node - without channel injection 103.18 kB +0.03% +24 B 🔺
@sentry/aws-serverless 96.42 kB +0.03% +27 B 🔺
@sentry/cloudflare (withSentry) - minified 201.04 kB - -
@sentry/cloudflare (withSentry) 500.26 kB - -

View base workflow run

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.

1 participant