Skip to content

✨ [RUM-246] Support prerendered pages for web vitals #3617

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

Draft
wants to merge 24 commits into
base: main
Choose a base branch
from

Conversation

BeltranBulbarellaDD
Copy link
Contributor

@BeltranBulbarellaDD BeltranBulbarellaDD commented Jun 10, 2025

Motivation

Chrome released prerendering support for Chrome 108+ and Edge 108+. This means that all load-related metrics should be relative to when the page was "activated" rather than when it started loading (for non-prerendered pages these values are the same).

Changes

Created interface DocumentWithPrerendering.
Created function getActivationStart which uses the new activationStart.
Adjusted LCP, FCP, TTFB and firstHidden for this new calculation.

Test instructions

All previous tests should pass, and when we mock activation start or have 2 html files where 1 prerenders the other we should see something similar to the image below.

Screenshot 2025-06-11 at 10 24 55
Screen.Recording.2025-06-26.at.10.06.08.mov

Checklist

  • [X ] Tested locally
  • Tested on staging
  • [X ] Added unit tests for this change.
  • [X ] Added e2e/integration tests for this change.

@codecov-commenter
Copy link

codecov-commenter commented Jun 10, 2025

Codecov Report

Attention: Patch coverage is 82.00000% with 9 lines in your changes missing coverage. Please review.

Project coverage is 92.14%. Comparing base (65f51ec) to head (5f259db).

Files with missing lines Patch % Lines
packages/core/src/browser/browser.types.ts 73.33% 4 Missing ⚠️
...c/domain/view/viewMetrics/trackPrerenderMetrics.ts 78.94% 4 Missing ⚠️
packages/rum-core/src/browser/performanceUtils.ts 80.00% 1 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main    #3617      +/-   ##
==========================================
- Coverage   92.21%   92.14%   -0.07%     
==========================================
  Files         326      328       +2     
  Lines        8182     8228      +46     
  Branches     1849     1869      +20     
==========================================
+ Hits         7545     7582      +37     
- Misses        637      646       +9     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@BeltranBulbarellaDD BeltranBulbarellaDD force-pushed the beltran.bulbarella/RUM-246-support-prerendered-pages-2 branch from 5ca9819 to 31361ac Compare June 10, 2025 08:17
@BeltranBulbarellaDD BeltranBulbarellaDD changed the title [RUM-10238] Use hooks for Logs SDK to decouple account (#3590) ✨ [RUM-246] Support prerendered pages for web vitals Jun 10, 2025
@BeltranBulbarellaDD BeltranBulbarellaDD force-pushed the beltran.bulbarella/RUM-246-support-prerendered-pages-2 branch from 042bba6 to 158a758 Compare June 10, 2025 15:43
@BeltranBulbarellaDD BeltranBulbarellaDD marked this pull request as ready for review June 12, 2025 08:19
@BeltranBulbarellaDD BeltranBulbarellaDD requested a review from a team as a code owner June 12, 2025 08:19
@BeltranBulbarellaDD BeltranBulbarellaDD marked this pull request as draft June 12, 2025 11:40
Copy link

cit-pr-commenter bot commented Jul 3, 2025

Bundles Sizes Evolution

📦 Bundle Name Base Size Local Size 𝚫 𝚫% Status
Rum 149.17 KiB 150.84 KiB 1.67 KiB +1.12%
Rum Recorder 17.91 KiB 17.91 KiB 0 B 0.00%
Rum Profiler 4.98 KiB 4.98 KiB 0 B 0.00%
Logs 52.87 KiB 52.87 KiB 0 B 0.00%
Flagging 0 B 931 B 931 B N/A%
Rum Slim 107.87 KiB 109.50 KiB 1.63 KiB +1.51%
Worker 23.60 KiB 23.60 KiB 0 B 0.00%
🚀 CPU Performance
Action Name Base Average Cpu Time (ms) Local Average Cpu Time (ms) 𝚫
addglobalcontext 0.011 0.012 0.001
addaction 0.025 0.032 0.007
addtiming 0.005 0.007 0.002
adderror 0.023 0.035 0.012
startstopsessionreplayrecording 0.004 0.005 0.001
startview 0.009 0.016 0.007
logmessage 0.023 0.029 0.006
🧠 Memory Performance
Action Name Base Consumption Memory (bytes) Local Consumption Memory (bytes) 𝚫 (bytes)
addglobalcontext 28.01 KiB 26.69 KiB -1356 B
addaction 55.48 KiB 53.46 KiB -2067 B
addtiming 27.50 KiB 26.24 KiB -1285 B
adderror 64.35 KiB 61.05 KiB -3383 B
startstopsessionreplayrecording 27.49 KiB 24.26 KiB -3309 B
startview 435.27 KiB 426.28 KiB -9197 B
logmessage 63.04 KiB 99.57 KiB 36.53 KiB

🔗 RealWorld

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