Skip to content
This repository was archived by the owner on Aug 30, 2023. It is now read-only.

feat: Only capture replays when errors happen#101

Merged
billyvg merged 7 commits intomainfrom
feat/capture-only-on-errors
Jul 21, 2022
Merged

feat: Only capture replays when errors happen#101
billyvg merged 7 commits intomainfrom
feat/capture-only-on-errors

Conversation

@billyvg
Copy link
Copy Markdown
Member

@billyvg billyvg commented Jun 30, 2022

This restores a previous functionality where we capture replays only when errors happen.

@billyvg billyvg force-pushed the feat/capture-only-on-errors branch from 028e1fd to d4f5145 Compare June 30, 2022 15:07
@billyvg
Copy link
Copy Markdown
Member Author

billyvg commented Jun 30, 2022

Closes #56

@billyvg
Copy link
Copy Markdown
Member Author

billyvg commented Jun 30, 2022

TODO: Need to defer creating the session (e.g. replay event) until we upload the replay (e.g. on error).

@billyvg billyvg linked an issue Jul 15, 2022 that may be closed by this pull request
billyvg added a commit that referenced this pull request Jul 15, 2022
I suspect we have a lot of "empty" replays due to this issue where we are immediately creating the root replay event. This had the possibility of having a replay w/ no recording events. Unfortunately, after some testing, a lot of short replays still get through because we immediately flush updates after a full DOM checkout. However, this is still needed in order to implement #101.
@billyvg billyvg force-pushed the feat/capture-only-on-errors branch from d4f5145 to dbce118 Compare July 18, 2022 17:32
@billyvg billyvg marked this pull request as ready for review July 18, 2022 21:50
@billyvg billyvg marked this pull request as draft July 18, 2022 21:50
billyvg added 3 commits July 19, 2022 12:04
This restores a previous functionality where we capture replays only when errors happen.
@billyvg billyvg force-pushed the feat/capture-only-on-errors branch from dbce118 to 87f6ef0 Compare July 19, 2022 22:04
@billyvg billyvg marked this pull request as ready for review July 19, 2022 22:04
@billyvg billyvg requested a review from a team July 19, 2022 22:04
Copy link
Copy Markdown
Member

@ryan953 ryan953 left a comment

Choose a reason for hiding this comment

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

The behavior to replace the other rrweb sdk!

Comment on lines +84 to +86
document.dispatchEvent(new Event('visibilitychange'));

expect(replay).not.toHaveSentReplay();
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

should we call await new Promise(process.nextTick); to really match how it works in prod?

afterAll(() => {
replay && replay.destroy();
});

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Another test case could be it('Does a full snapshot and clears the event buffer after a minute', () => ...

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

It's tested here:

// This should clear previous buffer
buffer.addEvent({ ...TEST_EVENT, type: 2 }, true);

@billyvg billyvg merged commit b85537b into main Jul 21, 2022
@billyvg billyvg deleted the feat/capture-only-on-errors branch July 21, 2022 18:37
mydea pushed a commit to getsentry/sentry-javascript that referenced this pull request Nov 23, 2022
…ay#106)

I suspect we have a lot of "empty" replays due to this issue where we are immediately creating the root replay event. This had the possibility of having a replay w/ no recording events. Unfortunately, after some testing, a lot of short replays still get through because we immediately flush updates after a full DOM checkout. However, this is still needed in order to implement getsentry/sentry-replay#101.
mydea pushed a commit to getsentry/sentry-javascript that referenced this pull request Nov 23, 2022
…y#101)

This restores a previous functionality where we capture replays only when errors happen.
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Support only recording replays when an error occurs

2 participants