Skip to content

Commit 9fbbd5a

Browse files
committed
feat(replay): Add breadcrumb when encountering large mutations
1 parent 4d54791 commit 9fbbd5a

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
@@ -198,6 +198,21 @@ export class ReplayContainer implements ReplayContainerInterface {
198198
// instead, we'll always keep the last 60 seconds of replay before an error happened
199199
...(this.recordingMode === 'error' && { checkoutEveryNms: ERROR_CHECKOUT_TIME }),
200200
emit: this._handleRecordingEmit,
201+
onMutation: (mutations: unknown[]) => {
202+
const count = mutations.length;
203+
204+
if (count > 500) {
205+
const breadcrumb = createBreadcrumb({
206+
category: 'replay.mutations',
207+
message: `A mutation with ${count} changes was recorded, which indicate slow performance.`,
208+
data: {
209+
mutationsCount: count,
210+
},
211+
});
212+
this._createCustomBreadcrumb(breadcrumb);
213+
}
214+
return true;
215+
},
201216
});
202217
} catch (err) {
203218
this._handleException(err);

0 commit comments

Comments
 (0)