Skip to content

Commit 78f9a08

Browse files
committed
ref(replay): Log warning if sample rates are all 0
1 parent d33b88c commit 78f9a08

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

packages/replay/src/integration.ts

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
import { getCurrentHub } from '@sentry/core';
22
import type { BrowserClientReplayOptions, Integration } from '@sentry/types';
3+
import { logger } from '@sentry/utils';
34

45
import { DEFAULT_FLUSH_MAX_DELAY, DEFAULT_FLUSH_MIN_DELAY, MASK_ALL_TEXT_SELECTOR } from './constants';
56
import { ReplayContainer } from './replay';
@@ -192,6 +193,11 @@ Sentry.init({ replaysOnErrorSampleRate: ${errorSampleRate} })`,
192193
// Client is not available in constructor, so we need to wait until setupOnce
193194
this._loadReplayOptionsFromClient();
194195

196+
if (!this._options.sessionSampleRate && !this._options.errorSampleRate) {
197+
// eslint-disable-next-line no-console
198+
console.warn('Replay is disabled because both `replaysSessionSampleRate` and `replaysOnErrorSampleRate` are 0');
199+
}
200+
195201
this._replay = new ReplayContainer({
196202
options: this._options,
197203
recordingOptions: this._recordingOptions,

0 commit comments

Comments
 (0)