Skip to content

Commit e861f46

Browse files
committed
no wiggle room
1 parent 745d848 commit e861f46

File tree

2 files changed

+18
-6
lines changed
  • dev-packages/browser-integration-tests/suites/replay/bufferModeManual
  • packages/replay-internal/src

2 files changed

+18
-6
lines changed

dev-packages/browser-integration-tests/suites/replay/bufferModeManual/test.ts

+16-3
Original file line numberDiff line numberDiff line change
@@ -350,7 +350,7 @@ sentryTest(
350350
);
351351

352352
sentryTest(
353-
'[buffer-mode] manually starting replay includes performance entries with 1s wiggle room',
353+
'[buffer-mode] manually starting replay ignores earlier performance entries when starting immediately',
354354
async ({ getLocalTestUrl, page, browserName }) => {
355355
// This was sometimes flaky on webkit, so skipping for now
356356
if (shouldSkipReplayTest() || browserName === 'webkit') {
@@ -388,8 +388,21 @@ sentryTest(
388388

389389
const { performanceSpans } = content0;
390390

391-
// web vitals etc. are included with 1s wiggle room, to accomodate "immediate" start
392-
expect(performanceSpans.length).toBeGreaterThan(1);
391+
expect(performanceSpans).toEqual([
392+
{
393+
op: 'memory',
394+
description: 'memory',
395+
startTimestamp: expect.any(Number),
396+
endTimestamp: expect.any(Number),
397+
data: {
398+
memory: {
399+
jsHeapSizeLimit: expect.any(Number),
400+
totalJSHeapSize: expect.any(Number),
401+
usedJSHeapSize: expect.any(Number),
402+
},
403+
},
404+
},
405+
]);
393406
},
394407
);
395408

packages/replay-internal/src/replay.ts

+2-3
Original file line numberDiff line numberDiff line change
@@ -1052,14 +1052,13 @@ export class ReplayContainer implements ReplayContainerInterface {
10521052
this.replayPerformanceEntries = [];
10531053

10541054
// If we are manually starting, we want to ensure we only include performance entries
1055-
// that are after the initial timestamp, with 1s wiggle room.
1055+
// that are after the initial timestamp
10561056
// The reason for this is that we may have performance entries from the page load, but may decide to start
10571057
// the replay later on, in which case we do not want to include these entries.
10581058
// without this, manually started replays can have events long before the actual replay recording starts,
10591059
// which messes with the timeline etc.
10601060
if (this._requiresManualStart) {
1061-
// We leave 1s wiggle room to accomodate timing differences for "immedidate" manual starts
1062-
const initialTimestampInSeconds = this._context.initialTimestamp / 1000 - 1;
1061+
const initialTimestampInSeconds = this._context.initialTimestamp / 1000;
10631062
performanceEntries = performanceEntries.filter(entry => entry.start >= initialTimestampInSeconds);
10641063
}
10651064

0 commit comments

Comments
 (0)