Skip to content

fix(replay): Fix checkoutEveryNms #6722

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 1 commit into from
Jan 11, 2023
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
10 changes: 4 additions & 6 deletions packages/replay/src/replay.ts
Original file line number Diff line number Diff line change
Expand Up @@ -178,10 +178,8 @@ export class ReplayContainer implements ReplayContainerInterface {
return;
}

// Modify recording options to checkoutEveryNthSecond if
// sampling for error replay. This is because we don't know
// when an error will occur, so we need to keep a buffer of
// replay events.
// If session is sampled for errors, then we need to set the recordingMode
// to 'error', which will configure recording with different options.
if (this.session.sampled === 'error') {
this.recordingMode = 'error';
}
Expand Down Expand Up @@ -211,10 +209,10 @@ export class ReplayContainer implements ReplayContainerInterface {
try {
this._stopRecording = record({
...this._recordingOptions,
// When running in error sampling mode, we need to overwrite `checkoutEveryNth`
// When running in error sampling mode, we need to overwrite `checkoutEveryNms`
// 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.recordingMode === 'error' && { checkoutEveryNth: 60000 }),
...(this.recordingMode === 'error' && { checkoutEveryNms: 60000 }),
emit: this.handleRecordingEmit,
});
} catch (err) {
Expand Down