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

🐛 do not calculate resource duration if page was in frozen state during resource duration #3349

Open
wants to merge 3 commits into
base: main
Choose a base branch
from

Conversation

thomas-lebeau
Copy link
Collaborator

@thomas-lebeau thomas-lebeau commented Feb 18, 2025

Motivation

Fixes Bug with resource duration where incorrect due to page being in a frozen state sometime during the request.

The intention was to set duration to undefined when the page was in a frozen state during the request duration (computeRequestDuration), however this was overridden by computeResourceEntryMetrics.

The unit tests where not catching the issue because no matching PerformanceResourceTiming was mocked.

Changes

  • Mock a matching PerformanceResourceTiming, making the unit test fail.
  • Make computeResourceEntryMetrics aware of frozen states and prevent calculating any durations when needed.
  • Improve fetch and XHR request collection unit test to take into account a matching PerformanceResourceTiming.

Testing

  • Local
  • Staging
  • Unit
  • End to end

I have gone over the contributing documentation.

@codecov-commenter
Copy link

codecov-commenter commented Feb 18, 2025

Codecov Report

Attention: Patch coverage is 91.66667% with 1 line in your changes missing coverage. Please review.

Project coverage is 92.84%. Comparing base (200982d) to head (c8059f8).
Report is 3 commits behind head on main.

Files with missing lines Patch % Lines
...rum-core/src/domain/resource/resourceCollection.ts 91.66% 1 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main    #3349      +/-   ##
==========================================
- Coverage   92.86%   92.84%   -0.03%     
==========================================
  Files         298      298              
  Lines        7845     7850       +5     
  Branches     1785     1787       +2     
==========================================
+ Hits         7285     7288       +3     
- Misses        560      562       +2     

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

Copy link

cit-pr-commenter bot commented Feb 18, 2025

Bundles Sizes Evolution

📦 Bundle Name Base Size Local Size 𝚫 𝚫% Status
Rum 147.64 KiB 147.74 KiB 104 B +0.07%
Logs 51.65 KiB 51.65 KiB 0 B 0.00%
Rum Slim 106.34 KiB 106.44 KiB 97 B +0.09%
Worker 24.50 KiB 24.50 KiB 0 B 0.00%
🚀 CPU Performance
Action Name Base Average Cpu Time (ms) Local Average Cpu Time (ms) 𝚫
addglobalcontext 0.002 0.002 -0.001
addaction 0.073 0.055 -0.018
addtiming 0.002 0.001 -0.000
adderror 0.104 0.053 -0.051
startstopsessionreplayrecording 0.014 0.012 -0.002
startview 0.522 0.412 -0.110
logmessage 0.035 0.023 -0.011
🧠 Memory Performance
Action Name Base Consumption Memory (bytes) Local Consumption Memory (bytes) 𝚫 (bytes)
addglobalcontext 28.88 KiB 31.26 KiB 2.38 KiB
addaction 57.28 KiB 57.76 KiB 488 B
addtiming 27.22 KiB 29.55 KiB 2.33 KiB
adderror 59.49 KiB 64.67 KiB 5.18 KiB
startstopsessionreplayrecording 25.91 KiB 27.71 KiB 1.80 KiB
startview 423.80 KiB 427.08 KiB 3.28 KiB
logmessage 64.10 KiB 61.96 KiB -2198 B

🔗 RealWorld

@thomas-lebeau thomas-lebeau force-pushed the thomas.lebeau/resource-duration-outlier branch 2 times, most recently from 51bf43b to e93703c Compare February 19, 2025 09:19
@thomas-lebeau thomas-lebeau force-pushed the thomas.lebeau/resource-duration-outlier branch from e93703c to c08d552 Compare February 19, 2025 09:20
@thomas-lebeau thomas-lebeau changed the title 🧪 [RUM-2513] add matching performance entry to fix resource collection test 🐛 do not calculate resource duration if page was in frozen state during resource duration Feb 19, 2025
@thomas-lebeau thomas-lebeau force-pushed the thomas.lebeau/resource-duration-outlier branch 2 times, most recently from 3f70f3d to 1b66de3 Compare February 20, 2025 08:14
@thomas-lebeau thomas-lebeau force-pushed the thomas.lebeau/resource-duration-outlier branch from 1b66de3 to c8059f8 Compare February 20, 2025 08:19
@thomas-lebeau thomas-lebeau marked this pull request as ready for review February 20, 2025 08:28
@thomas-lebeau thomas-lebeau requested a review from a team as a code owner February 20, 2025 08:28
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