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: JSEerrors harvest hasReplay decoration #986

Merged
merged 2 commits into from
Apr 18, 2024

Conversation

patrickhousley
Copy link
Contributor

In scenarios where the SessionReplay feature was preloaded but a recording was never started, errors happening on the page would be improperly decorated with the hasReplay flag.

Overview

This introduces a pre-harvest cross-feature communication event within the JSErrors feature. When a harvest occurs, the JSErrors feature will send out the cfc.jserrors event with an object containing information about the errors being harvested.

The SessionReplay feature has been updated to listen to the cfc.jserrors event and decorate the event payload with a hasReplay flag in the aggregate. The flag will be true only if the aggregate loaded, the aggregate has a running harvest scheduler, the aggregate has a recorder initialized, the mode is in FULL, the aggregate is not blocked, and the aggregate is entitled to harvest.

A check as been added to the JSErrors cfc function to check for the event data flag hasReplay. If any of the errors being harvested has the hasReplay flag present and truethy, but the cfc event data is missing the hasReplay flag or the flag is falsey, the harvest payload will be updated to remove the hasReplay flag off all the error params objects.

Note: If the hasReplay flag is missing in the cfc event data, it is indicative of the SessionReplay aggregate never loading. If it is present but has a false value, one of the above checks failed in the SessionReplay feature.

Related Issue(s)

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

Testing

A wdio test was added that presents a reproducible scenario where the SessionReplay feature is preloaded but not auto started. In such a scenario, the errors harvested would always have hasReplay but shouldn't.

Copy link

github-actions bot commented Apr 18, 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 31.17 kB / 10.93 kB (gzip) 31.17 kB / 10.93 kB (gzip) 0% / 0% (gzip)
lite async-chunk 51.56 kB / 16.71 kB (gzip) 51.56 kB / 16.71 kB (gzip) 0% / 0% (gzip)
pro loader 50.97 kB / 17.34 kB (gzip) 50.97 kB / 17.34 kB (gzip) 0% / -0.01% (gzip)
pro async-chunk 93.8 kB / 28.66 kB (gzip) 94 kB / 28.74 kB (gzip) 0.21% / 0.26% (gzip)
spa loader 59.53 kB / 19.93 kB (gzip) 59.53 kB / 19.93 kB (gzip) 0% / -0.01% (gzip)
spa async-chunk 108.28 kB / 32.88 kB (gzip) 108.48 kB / 32.96 kB (gzip) 0.18% / 0.22% (gzip)
lite-polyfills loader 125.13 kB / 40.22 kB (gzip) 125.13 kB / 40.22 kB (gzip) 0% / 0% (gzip)
lite-polyfills async-chunk 66.25 kB / 19.05 kB (gzip) 66.25 kB / 19.05 kB (gzip) 0% / 0% (gzip)
pro-polyfills loader 145.35 kB / 46.22 kB (gzip) 145.35 kB / 46.23 kB (gzip) 0% / 0% (gzip)
pro-polyfills async-chunk 128.74 kB / 33.52 kB (gzip) 128.89 kB / 33.57 kB (gzip) 0.11% / 0.15% (gzip)
spa-polyfills loader 153.38 kB / 48.36 kB (gzip) 153.38 kB / 48.36 kB (gzip) 0% / 0% (gzip)
spa-polyfills async-chunk 145.56 kB / 38.14 kB (gzip) 145.7 kB / 38.19 kB (gzip) 0.1% / 0.12% (gzip)

Copy link

codecov bot commented Apr 18, 2024

Codecov Report

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

Project coverage is 83.87%. Comparing base (4487242) to head (43dd8e9).
Report is 1 commits behind head on main.

Files Patch % Lines
src/features/jserrors/aggregate/index.js 46.66% 6 Missing and 2 partials ⚠️
src/features/session_replay/aggregate/index.js 62.50% 3 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main     #986      +/-   ##
==========================================
+ Coverage   83.80%   83.87%   +0.06%     
==========================================
  Files         153      153              
  Lines        7151     7149       -2     
  Branches     1408     1413       +5     
==========================================
+ Hits         5993     5996       +3     
+ Misses        988      981       -7     
- Partials      170      172       +2     
Flag Coverage Δ
unit-tests 67.34% <6.66%> (-0.03%) ⬇️

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

github-actions bot commented Apr 18, 2024

Static Badge

Last ran on April 18, 2024 07:27:50 CDT
Checking merge of (3e526a9) into main (4487242)

@patrickhousley
Copy link
Contributor Author

@patrickhousley patrickhousley merged commit 6dd09c5 into main Apr 18, 2024
17 of 18 checks passed
@patrickhousley patrickhousley deleted the jse-hasReplay-harvest-check branch April 18, 2024 17:08
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