Skip to content

Commit f6d98ec

Browse files
committed
feat(replay): Add breadcrumb when encountering large mutations
1 parent ae63bae commit f6d98ec

File tree

1 file changed

+15
-0
lines changed

1 file changed

+15
-0
lines changed

packages/replay/src/replay.ts

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -204,6 +204,21 @@ export class ReplayContainer implements ReplayContainerInterface {
204204
// instead, we'll always keep the last 60 seconds of replay before an error happened
205205
...(this.recordingMode === 'error' && { checkoutEveryNms: ERROR_CHECKOUT_TIME }),
206206
emit: this._handleRecordingEmit,
207+
onMutation: (mutations: unknown[]) => {
208+
const count = mutations.length;
209+
210+
if (count > 500) {
211+
const breadcrumb = createBreadcrumb({
212+
category: 'replay.mutations',
213+
message: `A mutation with ${count} changes was recorded, which indicate slow performance.`,
214+
data: {
215+
mutationsCount: count,
216+
},
217+
});
218+
this._createCustomBreadcrumb(breadcrumb);
219+
}
220+
return true;
221+
},
207222
});
208223
} catch (err) {
209224
this._handleException(err);

0 commit comments

Comments
 (0)