Skip to content

Commit 010185b

Browse files
committed
bumpbumpbump
1 parent 2deb000 commit 010185b

File tree

4 files changed

+58
-2
lines changed

4 files changed

+58
-2
lines changed
Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
import * as Sentry from '@sentry/browser';
2+
3+
window.Sentry = Sentry;
4+
window.Replay = Sentry.replayIntegration({
5+
flushMinDelay: 200,
6+
flushMaxDelay: 200,
7+
// Try to set to 60s - should be capped at 50s
8+
minReplayDuration: 60000,
9+
});
10+
11+
Sentry.init({
12+
dsn: 'https://public@dsn.ingest.sentry.io/1337',
13+
sampleRate: 0,
14+
replaysSessionSampleRate: 1.0,
15+
replaysOnErrorSampleRate: 0.0,
16+
17+
integrations: [window.Replay],
18+
});
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
<!doctype html>
2+
<html>
3+
<head>
4+
<meta charset="utf-8" />
5+
<title>Replay - minReplayDuration Limit</title>
6+
</head>
7+
<body>
8+
<div id="content">
9+
<p>Testing that minReplayDuration is capped at 50s max</p>
10+
</div>
11+
</body>
12+
</html>
Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
import { expect } from '@playwright/test';
2+
import { sentryTest } from '../../../utils/fixtures';
3+
import { shouldSkipReplayTest } from '../../../utils/replayHelpers';
4+
5+
sentryTest('caps minReplayDuration to maximum of 50 seconds', async ({ getLocalTestUrl, page }) => {
6+
if (shouldSkipReplayTest()) {
7+
sentryTest.skip();
8+
}
9+
10+
const url = await getLocalTestUrl({ testDir: __dirname });
11+
12+
await page.goto(url);
13+
14+
const actualMinReplayDuration = await page.evaluate(() => {
15+
// @ts-expect-error - Replay is not typed on window
16+
const replay = window.Replay;
17+
return replay._initialOptions.minReplayDuration;
18+
});
19+
20+
// Even though we configured it to 60s (60000ms), it should be capped to 50s
21+
expect(actualMinReplayDuration).toBe(50000);
22+
});

packages/replay-internal/src/constants.ts

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -45,8 +45,12 @@ export const REPLAY_MAX_EVENT_BUFFER_SIZE = 20_000_000; // ~20MB
4545

4646
/** Replays must be min. 5s long before we send them. */
4747
export const MIN_REPLAY_DURATION = 4_999;
48-
/* The max. allowed value that the minReplayDuration can be set to. */
49-
export const MIN_REPLAY_DURATION_LIMIT = 15_000;
48+
49+
/*
50+
The max. allowed value that the minReplayDuration can be set to.
51+
This needs to be below 60s, so we don't unintentionally drop buffered replays that are longer than 60s.
52+
*/
53+
export const MIN_REPLAY_DURATION_LIMIT = 50_000;
5054

5155
/** The max. length of a replay. */
5256
export const MAX_REPLAY_DURATION = 3_600_000; // 60 minutes in ms;

0 commit comments

Comments
 (0)