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

ref(replay): Avoid overwriting user checkoutEveryNms config #6454

Merged
merged 2 commits into from
Dec 7, 2022
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 4 additions & 3 deletions packages/replay/src/replay.ts
Original file line number Diff line number Diff line change
Expand Up @@ -158,8 +158,6 @@ export class ReplayContainer {
// when an error will occur, so we need to keep a buffer of
// replay events.
if (this.session.sampled === 'error') {
// Checkout every minute, meaning we only get up-to one minute of events before the error happens
this.recordingOptions.checkoutEveryNms = 60000;
this._waitForError = true;
}

Expand Down Expand Up @@ -187,6 +185,10 @@ export class ReplayContainer {
try {
this._stopRecording = record({
...this.recordingOptions,
// When running in error sampling mode, we need to overwrite `checkoutEveryNth`
// Without this, it would record forever, until an error happens, which we don't want
// instead, we'll always keep the last 60 seconds of replay before an error happened
...(this._waitForError && { checkoutEveryNth: 60000 }),
emit: this.handleRecordingEmit,
});
} catch (err) {
Expand Down Expand Up @@ -470,7 +472,6 @@ export class ReplayContainer {
this._stopRecording();
// Reset all "capture on error" configuration before
// starting a new recording
delete this.recordingOptions.checkoutEveryNms;
this._waitForError = false;
this.startRecording();
}
Expand Down