Skip to content
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

feat(browser): Add navigation activationStart timestamp to pageload span #13658

Merged
merged 2 commits into from
Sep 13, 2024

Conversation

Lms24
Copy link
Member

@Lms24 Lms24 commented Sep 10, 2024

In prerendering scenarios, where a page might be prefetched and pre-rendered before the user clicks a link, the performance API starts measuring the navigation earlier than when the user clicks it. Web Vital measurements however are always based on the user-perceived (loading) time, so they are not reported from the actual start of the navigation, but rather from the time where the user actively started the navigation, for example by clicking a link. This user action is called "activation" and the time between navigation start and activation is stored in the activationStart attribute of the "navigation" PerformanceEntry.

This PR adds this activationStart property as it gets reported by the browser as performance.activationStart span attribute to the pageload span. The browser gives us a relative time in ms, based on the startTime attribute. The startTime attribute is always 0 for navigation entry but in absolute numbers, it corresponds to performance.timeOrigin (which we already send as a span attribute since #13502). So if necessary, in the product, we can calculate the absolute timestamp via performance.timeOrigin + performance.activationStart.

We can use this attribute as a heuristic where to draw the vertical web vital lines for TTFB, LCP (and possibly FCP) from.

Copy link
Contributor

github-actions bot commented Sep 10, 2024

size-limit report 📦

Path Size % Change Change
@sentry/browser 22.52 KB -0.01% -1 B 🔽
@sentry/browser - with treeshaking flags 21.3 KB -0.01% -1 B 🔽
@sentry/browser (incl. Tracing) 34.79 KB +0.03% +9 B 🔺
@sentry/browser (incl. Tracing, Replay) 71.24 KB +0.02% +13 B 🔺
@sentry/browser (incl. Tracing, Replay) - with treeshaking flags 61.68 KB +0.03% +16 B 🔺
@sentry/browser (incl. Tracing, Replay with Canvas) 75.59 KB +0.03% +18 B 🔺
@sentry/browser (incl. Tracing, Replay, Feedback) 88.31 KB +0.02% +14 B 🔺
@sentry/browser (incl. Tracing, Replay, Feedback, metrics) 90.16 KB +0.02% +16 B 🔺
@sentry/browser (incl. metrics) 26.83 KB -0.01% -1 B 🔽
@sentry/browser (incl. Feedback) 39.6 KB -0.01% -1 B 🔽
@sentry/browser (incl. sendFeedback) 27.19 KB -0.01% -1 B 🔽
@sentry/browser (incl. FeedbackAsync) 31.9 KB - -
@sentry/react 25.28 KB -0.01% -1 B 🔽
@sentry/react (incl. Tracing) 37.76 KB +0.05% +17 B 🔺
@sentry/vue 26.72 KB - -
@sentry/vue (incl. Tracing) 36.67 KB +0.03% +11 B 🔺
@sentry/svelte 22.65 KB - -
CDN Bundle 23.77 KB - -
CDN Bundle (incl. Tracing) 36.5 KB +0.04% +14 B 🔺
CDN Bundle (incl. Tracing, Replay) 70.92 KB +0.02% +13 B 🔺
CDN Bundle (incl. Tracing, Replay, Feedback) 76.23 KB +0.02% +10 B 🔺
CDN Bundle - uncompressed 69.63 KB - -
CDN Bundle (incl. Tracing) - uncompressed 108.25 KB +0.05% +51 B 🔺
CDN Bundle (incl. Tracing, Replay) - uncompressed 219.92 KB +0.03% +51 B 🔺
CDN Bundle (incl. Tracing, Replay, Feedback) - uncompressed 233.11 KB +0.03% +51 B 🔺
@sentry/nextjs (client) 37.53 KB +0.05% +18 B 🔺
@sentry/sveltekit (client) 35.37 KB +0.03% +9 B 🔺
@sentry/node 120.5 KB -0.01% -2 B 🔽
@sentry/node - without tracing 92.78 KB -0.01% -2 B 🔽
@sentry/aws-serverless 102.49 KB -0.01% -2 B 🔽

View base workflow run

@Lms24 Lms24 self-assigned this Sep 10, 2024
@Lms24 Lms24 merged commit 2140083 into develop Sep 13, 2024
125 of 126 checks passed
@Lms24 Lms24 deleted the lms/feat-browser-web-vitals-perf-activationStart branch September 13, 2024 12:11
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