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

fix: Server Timing - Remove reliance on performance API #930

Merged
merged 1 commit into from
Mar 26, 2024

Conversation

patrickhousley
Copy link
Contributor

Removing reliance on the browser resources API for the calculation of New Relic server time. On site with many resource requests, there was a small chance that the RUM network call would be flushed from the resources API cache before we could capture it and calculate server time.

Overview

Simplifying the NR server time calculation to use our own captured start and end times for the RUM network request. On our internal NR site, we were rarely seeing an error related to the time keeper not being able to calculate server time. The cause was found to be the RUM call missing from the resources API buffer. This is most likely because there is a max buffer size in the browser after which the browser starts dropping older resource requests.

We decided to not use a more precise method of setting up a resource observer simply because it has a lot of code and logic overhead for little gain (hundreds of milliseconds). We are also planning to cache the server time across page loads and tabs.

Related Issue(s)

N/A - Pre-release issue

Testing

Copy link

Asset Size Report

Merging this pull request will result in the following asset size changes:

Agent Asset Previous Size New Size Diff
lite loader 32.28 kB / 11.27 kB (gzip) 31.98 kB / 11.17 kB (gzip) -0.94% / -0.87% (gzip)
lite async-chunk 46.67 kB / 15.33 kB (gzip) 46.72 kB / 15.35 kB (gzip) 0.11% / 0.09% (gzip)
pro loader 51.45 kB / 17.48 kB (gzip) 51.14 kB / 17.41 kB (gzip) -0.59% / -0.45% (gzip)
pro async-chunk 88.05 kB / 27.04 kB (gzip) 88.1 kB / 27.05 kB (gzip) 0.06% / 0.04% (gzip)
spa loader 60.01 kB / 20.11 kB (gzip) 59.71 kB / 20 kB (gzip) -0.5% / -0.55% (gzip)
spa async-chunk 102.26 kB / 31.2 kB (gzip) 102.32 kB / 31.22 kB (gzip) 0.05% / 0.06% (gzip)
lite-polyfills loader 127.5 kB / 40.98 kB (gzip) 127.21 kB / 40.89 kB (gzip) -0.23% / -0.22% (gzip)
lite-polyfills async-chunk 60.19 kB / 17.58 kB (gzip) 60.23 kB / 17.58 kB (gzip) 0.06% / 0.03% (gzip)
pro-polyfills loader 147.53 kB / 46.91 kB (gzip) 147.24 kB / 46.81 kB (gzip) -0.2% / -0.2% (gzip)
pro-polyfills async-chunk 122.51 kB / 31.95 kB (gzip) 122.55 kB / 31.96 kB (gzip) 0.03% / 0.03% (gzip)
spa-polyfills loader 155.55 kB / 49.02 kB (gzip) 155.26 kB / 48.93 kB (gzip) -0.19% / -0.19% (gzip)
spa-polyfills async-chunk 139.01 kB / 36.43 kB (gzip) 139.04 kB / 36.44 kB (gzip) 0.03% / 0.03% (gzip)

Copy link

codecov bot commented Mar 26, 2024

Codecov Report

Attention: Patch coverage is 33.33333% with 6 lines in your changes are missing coverage. Please review.

Project coverage is 80.49%. Comparing base (7a1ba34) to head (fa19ce2).

❗ Current head fa19ce2 differs from pull request most recent head 2083047. Consider uploading reports for the commit 2083047 to get more accurate results

Files Patch % Lines
src/features/page_view_event/aggregate/index.js 0.00% 4 Missing ⚠️
src/common/timing/time-keeper.js 60.00% 2 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main     #930      +/-   ##
==========================================
- Coverage   80.56%   80.49%   -0.07%     
==========================================
  Files         154      154              
  Lines        7058     7050       -8     
  Branches     1398     1395       -3     
==========================================
- Hits         5686     5675      -11     
- Misses       1168     1171       +3     
  Partials      204      204              
Flag Coverage Δ
unit-tests 58.29% <33.33%> (-0.13%) ⬇️

Flags with carried forward coverage won't be shown. Click here to find out more.

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

@patrickhousley patrickhousley merged commit 250efcd into main Mar 26, 2024
15 checks passed
@patrickhousley patrickhousley deleted the fix-rum-time branch March 26, 2024 16:07
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