Skip to content

Commit e954fe0

Browse files
committed
update error -> buffer
1 parent 7273861 commit e954fe0

File tree

5 files changed

+14
-9
lines changed

5 files changed

+14
-9
lines changed

packages/browser-integration-tests/suites/replay/errors/errorMode/test.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ import {
1616
} from '../../../../utils/replayHelpers';
1717

1818
sentryTest(
19-
'[error-mode] should start recording, only sample the 2nd error, and switch to session mode once an error is thrown',
19+
'[error-mode] should start recording and switch to session mode once an error is thrown',
2020
async ({ getLocalTestPath, page, browserName }) => {
2121
// This was sometimes flaky on firefox/webkit, so skipping for now
2222
if (shouldSkipReplayTest() || ['firefox', 'webkit'].includes(browserName)) {

packages/replay/src/integration.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -185,7 +185,7 @@ Sentry.init({ replaysOnErrorSampleRate: ${errorSampleRate} })`,
185185
* create a new session. Will throw an error if replay is already in progress.
186186
*
187187
* Creates or loads a session, attaches listeners to varying events (DOM,
188-
* _performanceObserver, Recording, Sentry SDK, etc)
188+
* PerformanceObserver, Recording, Sentry SDK, etc)
189189
*/
190190
public start(): void {
191191
if (!this._replay) {

packages/replay/test/integration/coreHandlers/handleGlobalEvent.test.ts

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
import type { Event } from '@sentry/types';
22

3+
import type { Replay as ReplayIntegration } from '../../../src';
34
import { REPLAY_EVENT_NAME } from '../../../src/constants';
45
import { handleGlobalEventListener } from '../../../src/coreHandlers/handleGlobalEvent';
56
import type { ReplayContainer } from '../../../src/replay';
@@ -84,8 +85,10 @@ describe('Integration | coreHandlers | handleGlobalEvent', () => {
8485
});
8586

8687
it('tags errors and transactions with replay id for session samples', async () => {
87-
({ replay } = await resetSdkMock({}));
88-
replay.start();
88+
let integration: ReplayIntegration;
89+
({ replay, integration } = await resetSdkMock({}));
90+
// @ts-ignore protected but ok to use for testing
91+
integration._initialize();
8992
const transaction = Transaction();
9093
const error = Error();
9194
expect(handleGlobalEventListener(replay)(transaction, {})).toEqual(

packages/replay/test/integration/errorSampleRate.test.ts

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,7 @@ describe('Integration | errorSampleRate', () => {
7171
expect(replay).toHaveSentReplay({
7272
recordingPayloadHeader: { segment_id: 0 },
7373
replayEventPayload: expect.objectContaining({
74-
replay_type: 'error',
74+
replay_type: 'buffer',
7575
contexts: {
7676
replay: {
7777
error_sample_rate: 1,
@@ -103,7 +103,7 @@ describe('Integration | errorSampleRate', () => {
103103
expect(replay).toHaveLastSentReplay({
104104
recordingPayloadHeader: { segment_id: 1 },
105105
replayEventPayload: expect.objectContaining({
106-
replay_type: 'error',
106+
replay_type: 'buffer',
107107
contexts: {
108108
replay: {
109109
error_sample_rate: 1,
@@ -523,12 +523,15 @@ it('sends a replay after loading the session multiple times', async () => {
523523
// Pretend that a session is already saved before loading replay
524524
WINDOW.sessionStorage.setItem(
525525
REPLAY_SESSION_KEY,
526-
`{"segmentId":0,"id":"fd09adfc4117477abc8de643e5a5798a","sampled":"error","started":${BASE_TIMESTAMP},"lastActivity":${BASE_TIMESTAMP}}`,
526+
`{"segmentId":0,"id":"fd09adfc4117477abc8de643e5a5798a","sampled":"buffer","started":${BASE_TIMESTAMP},"lastActivity":${BASE_TIMESTAMP}}`,
527527
);
528528
const { mockRecord, replay, integration } = await resetSdkMock({
529529
replayOptions: {
530530
stickySession: true,
531531
},
532+
sentryOptions: {
533+
replaysOnErrorSampleRate: 1.0,
534+
},
532535
autoStart: false,
533536
});
534537
// @ts-ignore this is protected, but we want to call it for this test
@@ -547,7 +550,6 @@ it('sends a replay after loading the session multiple times', async () => {
547550
await new Promise(process.nextTick);
548551
jest.advanceTimersByTime(DEFAULT_FLUSH_MIN_DELAY);
549552
await new Promise(process.nextTick);
550-
await new Promise(process.nextTick);
551553

552554
expect(replay).toHaveSentReplay({
553555
recordingData: JSON.stringify([{ data: { isCheckout: true }, timestamp: BASE_TIMESTAMP, type: 2 }, TEST_EVENT]),

packages/replay/test/unit/session/sessionSampling.test.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ describe('Unit | session | sessionSampling', () => {
2222
sampled: getSessionSampleType(0, 1),
2323
});
2424

25-
expect(newSession.sampled).toBe('error');
25+
expect(newSession.sampled).toBe('buffer');
2626
});
2727

2828
it('does not run sampling function if existing session was sampled', function () {

0 commit comments

Comments
 (0)