Skip to content

feat(browser): Record standalone LCP spans #16591

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 2 commits into
base: develop
Choose a base branch
from

Conversation

Lms24
Copy link
Member

@Lms24 Lms24 commented Jun 16, 2025

This PR implements sending standalone LCP spans as an opt-in feature.

Behaviour-wise, it's mostly aligned with our prior implementation of sending CLS standalone spans (#13056):

  • add an _experiments.enableStandaloneLcpSpans option and treat it as opt-in
  • keep collecting LCP values until users soft-navigate or the page is hidden
  • then, send the LCP span once
  • adds all lcp.* span attributes as well as the lcp measurement to the span

(depending on if we merge #16589 or this first, we might need to readjust size limit)

closes #13063

Copy link
Contributor

github-actions bot commented Jun 16, 2025

size-limit report 📦

Path Size % Change Change
@sentry/browser 23.99 kB - -
@sentry/browser - with treeshaking flags 23.76 kB - -
@sentry/browser (incl. Tracing) 39 kB +0.54% +208 B 🔺
⛔️ @sentry/browser (incl. Tracing, Replay) (max: 77 kB) 77.08 kB +0.25% +192 B 🔺
⛔️ @sentry/browser (incl. Tracing, Replay) - with treeshaking flags (max: 70.1 kB) 70.17 kB +0.29% +200 B 🔺
@sentry/browser (incl. Tracing, Replay with Canvas) 81.86 kB +0.26% +206 B 🔺
@sentry/browser (incl. Tracing, Replay, Feedback) 93.93 kB +0.22% +204 B 🔺
@sentry/browser (incl. Feedback) 40.73 kB - -
@sentry/browser (incl. sendFeedback) 28.7 kB - -
@sentry/browser (incl. FeedbackAsync) 33.59 kB - -
@sentry/react 25.76 kB - -
@sentry/react (incl. Tracing) 40.97 kB +0.46% +186 B 🔺
@sentry/vue 28.36 kB - -
@sentry/vue (incl. Tracing) 40.84 kB +0.46% +183 B 🔺
@sentry/svelte 24.01 kB - -
CDN Bundle 25.48 kB - -
⛔️ CDN Bundle (incl. Tracing) (max: 39 kB) 39.16 kB +0.51% +195 B 🔺
CDN Bundle (incl. Tracing, Replay) 74.97 kB +0.26% +190 B 🔺
CDN Bundle (incl. Tracing, Replay, Feedback) 80.39 kB +0.24% +189 B 🔺
CDN Bundle - uncompressed 74.48 kB - -
CDN Bundle (incl. Tracing) - uncompressed 116.51 kB +1.05% +1.21 kB 🔺
CDN Bundle (incl. Tracing, Replay) - uncompressed 230.48 kB +0.53% +1.21 kB 🔺
CDN Bundle (incl. Tracing, Replay, Feedback) - uncompressed 243.3 kB +0.5% +1.21 kB 🔺
@sentry/nextjs (client) 42.62 kB +0.42% +178 B 🔺
@sentry/sveltekit (client) 39.46 kB +0.46% +179 B 🔺
@sentry/node 150.65 kB +0.01% +1 B 🔺
@sentry/node - without tracing 98.4 kB +0.01% +1 B 🔺
@sentry/aws-serverless 124.16 kB - -

View base workflow run

@Lms24 Lms24 self-assigned this Jun 16, 2025
Comment on lines -61 to -62
// TODO: Figure out if we can switch to using whenIdleOrHidden instead of onHidden
// use pagehide event from web-vitals
Copy link
Member Author

@Lms24 Lms24 Jun 16, 2025

Choose a reason for hiding this comment

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

we most definitely don't want to switch to this, because idle fires too early. Removed the comment I added in #16310

Copy link
Contributor

@edwardgou-sentry edwardgou-sentry left a comment

Choose a reason for hiding this comment

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

Thanks!

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.

Send Standalone LCP spans
2 participants