Skip to content

feat: Calculate New Relic time in the agent #911

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

Merged
merged 4 commits into from
Mar 15, 2024
Merged

Conversation

patrickhousley
Copy link
Contributor

Migrating the process of time-stamping harvested data to the agent. The agent will utilize the date and time reported by the ingest pipeline during the RUM call as well as browser network and timing stats to derive a server time offset that can be applied to harvested data as event occur. This will improve the ability to visualize the harvested data on a timeline within New Relic UI.

Overview

Adding a new time keeper class to the agent that will utilize the RUM network call and the resource performance APIs to calculate the server time offset. This can then be used by features and other aspects of the agent to correct an absolute timestamp from browser time to server time and convert a time value relative to page origin to a timestamp that accounts for the server time offset.

Related Issue(s)

https://new-relic.atlassian.net/browse/NR-222414

Testing

@patrickhousley patrickhousley marked this pull request as draft March 5, 2024 23:46
Copy link

github-actions bot commented Mar 5, 2024

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.24 kB / 11.17 kB (gzip) 32.46 kB / 11.31 kB (gzip) 0.69% / 1.28% (gzip)
lite async-chunk 46.11 kB / 15.13 kB (gzip) 46.45 kB / 15.27 kB (gzip) 0.74% / 0.98% (gzip)
pro loader 51.45 kB / 17.39 kB (gzip) 51.63 kB / 17.54 kB (gzip) 0.34% / 0.85% (gzip)
pro async-chunk 87.32 kB / 26.8 kB (gzip) 87.67 kB / 26.96 kB (gzip) 0.41% / 0.6% (gzip)
spa loader 60.1 kB / 20.01 kB (gzip) 60.2 kB / 20.16 kB (gzip) 0.17% / 0.79% (gzip)
spa async-chunk 101.44 kB / 30.94 kB (gzip) 101.79 kB / 31.1 kB (gzip) 0.35% / 0.5% (gzip)
lite-polyfills loader 127.67 kB / 40.65 kB (gzip) 128.8 kB / 41.08 kB (gzip) 0.89% / 1.08% (gzip)
lite-polyfills async-chunk 58.49 kB / 17.23 kB (gzip) 58.81 kB / 17.4 kB (gzip) 0.55% / 0.96% (gzip)
pro-polyfills loader 147.77 kB / 46.6 kB (gzip) 148.83 kB / 47.04 kB (gzip) 0.72% / 0.94% (gzip)
pro-polyfills async-chunk 120.76 kB / 31.65 kB (gzip) 121.11 kB / 31.83 kB (gzip) 0.29% / 0.55% (gzip)
spa-polyfills loader 155.9 kB / 48.71 kB (gzip) 156.85 kB / 49.14 kB (gzip) 0.61% / 0.87% (gzip)
spa-polyfills async-chunk 136.11 kB / 36.33 kB (gzip) 136.46 kB / 36.5 kB (gzip) 0.25% / 0.45% (gzip)

@patrickhousley patrickhousley force-pushed the derive-nr-time branch 2 times, most recently from a56d1ca to f278e24 Compare March 13, 2024 21:46
@patrickhousley patrickhousley marked this pull request as ready for review March 13, 2024 21:47
Copy link

github-actions bot commented Mar 13, 2024

Static Badge

Last ran on March 15, 2024 15:31:37 CDT
Checking merge of (22612c3) into main (a52c57b)

Copy link

codecov bot commented Mar 13, 2024

Codecov Report

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

Project coverage is 80.42%. Comparing base (a52c57b) to head (22612c3).

Files Patch % Lines
src/features/page_view_event/aggregate/index.js 0.00% 9 Missing ⚠️
src/common/timing/time-keeper.js 92.85% 3 Missing ⚠️
src/common/wrap/wrap-fetch.js 0.00% 0 Missing and 1 partial ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main     #911      +/-   ##
==========================================
+ Coverage   80.19%   80.42%   +0.22%     
==========================================
  Files         154      154              
  Lines        7010     7044      +34     
  Branches     1389     1386       -3     
==========================================
+ Hits         5622     5665      +43     
+ Misses       1170     1163       -7     
+ Partials      218      216       -2     
Flag Coverage Δ
integration-tests 89.77% <75.00%> (-0.10%) ⬇️
unit-tests 58.38% <80.70%> (+0.45%) ⬆️

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.

Copy link
Member

@metal-messiah metal-messiah left a comment

Choose a reason for hiding this comment

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

General concept looks good, g2g when tests are done

@patrickhousley patrickhousley merged commit 91b1f96 into main Mar 15, 2024
@patrickhousley patrickhousley deleted the derive-nr-time branch March 15, 2024 20:32
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.

3 participants