Skip to content

Commit df5b2d5

Browse files
committed
add experiment
1 parent e7bb00d commit df5b2d5

File tree

2 files changed

+13
-11
lines changed

2 files changed

+13
-11
lines changed

packages/replay/src/replay.ts

Lines changed: 12 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -199,17 +199,18 @@ export class ReplayContainer implements ReplayContainerInterface {
199199
...(this.recordingMode === 'error' && { checkoutEveryNms: ERROR_CHECKOUT_TIME }),
200200
emit: this._handleRecordingEmit,
201201
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 may indicate slow performance.`,
208-
data: {
209-
mutationsCount: count,
210-
},
211-
});
212-
this._createCustomBreadcrumb(breadcrumb);
202+
if (this._options._experiments.captureMutationSize) {
203+
const count = mutations.length;
204+
205+
if (count > 500) {
206+
const breadcrumb = createBreadcrumb({
207+
category: 'replay.mutations',
208+
data: {
209+
length: count,
210+
},
211+
});
212+
this._createCustomBreadcrumb(breadcrumb);
213+
}
213214
}
214215
// `true` means we use the regular mutation handling by rrweb
215216
return true;

packages/replay/src/types.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -105,6 +105,7 @@ export interface ReplayPluginOptions extends SessionOptions {
105105
_experiments: Partial<{
106106
captureExceptions: boolean;
107107
traceInternals: boolean;
108+
captureMutationSize: boolean;
108109
}>;
109110
}
110111

0 commit comments

Comments
 (0)