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

feat: Session Replay API #803

Merged
merged 9 commits into from
Nov 13, 2023
Merged

feat: Session Replay API #803

merged 9 commits into from
Nov 13, 2023

Conversation

metal-messiah
Copy link
Member

@metal-messiah metal-messiah commented Nov 3, 2023

Add two new APIs for controlling session replay behaviors -- newrelic.recordReplay() and newrelic.pauseReplay().

Overview

This PR adds two new APIs that can give more control over session replay behaviors:

  • newrelic.recordReplay()
    • This API will be ignored if the Session Replay entitlement was not seen
    • This API will cause a replay to start recording if not started
    • This API will cause a replay to resume recording if previously started but not actively recording
    • This API will be ignored if a replay is already in progress
    • This API will shift the "mode" from "off" or "error" to "full" mode, and replays will continue running across pages until stopped by the pauseReplay() API or the session ending.
    • This API will start a session trace if not already in progress. The related session trace will not be stopped by "pauseReplay"
  • newrelic.pauseReplay()
    • This API will cause a replay to pause recording if actively recording
    • This API will be ignored if a replay is not already in progress
    • This API will shift the "mode" from "full" or "error" to "off" mode, and replays will not continue running on any subsequent page until resumed using the recordReplay() API.

Related Issue(s)

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

Testing

New tests have been added to validate these behaviors.

Copy link

github-actions bot commented Nov 3, 2023

Asset Size Report

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

Agent Asset Previous Size New Size Diff
lite loader 30.6 kB / 10.48 kB (gzip) 31.12 kB / 10.55 kB (gzip) 1.71% / 0.73% (gzip)
lite async-chunk 45.45 kB / 15.02 kB (gzip) 45.45 kB / 15.02 kB (gzip) 0% / 0% (gzip)
pro loader 48 kB / 15.89 kB (gzip) 48.52 kB / 15.96 kB (gzip) 1.09% / 0.45% (gzip)
pro async-chunk 73.64 kB / 23.46 kB (gzip) 74.26 kB / 23.61 kB (gzip) 0.84% / 0.64% (gzip)
spa loader 54.45 kB / 17.87 kB (gzip) 54.97 kB / 17.95 kB (gzip) 0.96% / 0.48% (gzip)
spa async-chunk 88.13 kB / 27.83 kB (gzip) 88.75 kB / 27.97 kB (gzip) 0.7% / 0.5% (gzip)
lite-polyfills loader 122.05 kB / 39.45 kB (gzip) 122.6 kB / 39.54 kB (gzip) 0.45% / 0.22% (gzip)
lite-polyfills async-chunk 57.81 kB / 17.2 kB (gzip) 57.81 kB / 17.2 kB (gzip) 0% / 0% (gzip)
pro-polyfills loader 141.57 kB / 45.33 kB (gzip) 142.11 kB / 45.42 kB (gzip) 0.39% / 0.2% (gzip)
pro-polyfills async-chunk 101.34 kB / 27.21 kB (gzip) 101.47 kB / 27.25 kB (gzip) 0.12% / 0.17% (gzip)
spa-polyfills loader 149.59 kB / 47.46 kB (gzip) 150.13 kB / 47.55 kB (gzip) 0.37% / 0.19% (gzip)
spa-polyfills async-chunk 116.5 kB / 31.67 kB (gzip) 116.63 kB / 31.71 kB (gzip) 0.11% / 0.15% (gzip)

Copy link

codecov bot commented Nov 3, 2023

Codecov Report

Attention: 16 lines in your changes are missing coverage. Please review.

Comparison is base (92d864c) 78.50% compared to head (608c2cd) 78.40%.
Report is 3 commits behind head on main.

Files Patch % Lines
src/features/session_trace/aggregate/index.js 62.50% 7 Missing and 2 partials ⚠️
src/loaders/agent-base.js 0.00% 4 Missing ⚠️
src/features/session_replay/aggregate/index.js 92.85% 1 Missing and 1 partial ⚠️
src/loaders/api/api.js 88.88% 1 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main     #803      +/-   ##
==========================================
- Coverage   78.50%   78.40%   -0.10%     
==========================================
  Files         142      142              
  Lines        6256     6335      +79     
  Branches     1217     1231      +14     
==========================================
+ Hits         4911     4967      +56     
- Misses       1148     1158      +10     
- Partials      197      210      +13     
Flag Coverage Δ
integration-tests 88.26% <94.44%> (+0.06%) ⬆️
unit-tests 55.14% <45.83%> (-0.14%) ⬇️

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 Nov 8, 2023

Static Badge

Last ran on November 13, 2023 17:13:32 CST
Checking merge of (608c2cd) into main (92d864c)

@metal-messiah metal-messiah marked this pull request as ready for review November 9, 2023 20:13
@metal-messiah metal-messiah changed the title feat: Session Replay API [WIP] feat: Session Replay API Nov 9, 2023
@metal-messiah metal-messiah merged commit 12eb453 into main Nov 13, 2023
44 of 48 checks passed
@metal-messiah metal-messiah deleted the session-replay-api branch November 13, 2023 23:13
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