@@ -146,8 +146,8 @@ export class Replay implements Integration {
146
146
initialFlushDelay = 5000 ,
147
147
stickySession = true ,
148
148
useCompression = true ,
149
- sessionSampleRate = DEFAULT_SESSION_SAMPLE_RATE ,
150
- errorSampleRate = DEFAULT_ERROR_SAMPLE_RATE ,
149
+ sessionSampleRate,
150
+ errorSampleRate,
151
151
maskAllText = true ,
152
152
maskAllInputs = true ,
153
153
blockAllMedia = true ,
@@ -171,13 +171,37 @@ export class Replay implements Integration {
171
171
flushMaxDelay,
172
172
stickySession,
173
173
initialFlushDelay,
174
- sessionSampleRate,
175
- errorSampleRate,
174
+ sessionSampleRate : DEFAULT_SESSION_SAMPLE_RATE ,
175
+ errorSampleRate : DEFAULT_ERROR_SAMPLE_RATE ,
176
176
useCompression,
177
177
maskAllText,
178
178
blockAllMedia,
179
179
} ;
180
180
181
+ if ( typeof sessionSampleRate === 'number' ) {
182
+ // eslint-disable-next-line
183
+ console . warn (
184
+ `[Replay] You are passing \`sessionSampleRate\` to the Replay integration.
185
+ This option is deprecated and will be removed soon.
186
+ Instead, configure \`replaysSessionSampleRate\` directly in the SDK init options, e.g.:
187
+ Sentry.init({ replaysSessionSampleRate: ${ sessionSampleRate } })` ,
188
+ ) ;
189
+
190
+ this . options . sessionSampleRate = sessionSampleRate ;
191
+ }
192
+
193
+ if ( typeof errorSampleRate === 'number' ) {
194
+ // eslint-disable-next-line
195
+ console . warn (
196
+ `[Replay] You are passing \`errorSampleRate\` to the Replay integration.
197
+ This option is deprecated and will be removed soon.
198
+ Instead, configure \`replaysOnErrorSampleRate\` directly in the SDK init options, e.g.:
199
+ Sentry.init({ replaysOnErrorSampleRate: ${ errorSampleRate } })` ,
200
+ ) ;
201
+
202
+ this . options . errorSampleRate = errorSampleRate ;
203
+ }
204
+
181
205
if ( this . options . maskAllText ) {
182
206
// `maskAllText` is a more user friendly option to configure
183
207
// `maskTextSelector`. This means that all nodes will have their text
@@ -1354,11 +1378,11 @@ export class Replay implements Integration {
1354
1378
const client = getCurrentHub ( ) . getClient ( ) as BrowserClient | undefined ;
1355
1379
const opt = client && ( client . getOptions ( ) as BrowserOptions | undefined ) ;
1356
1380
1357
- if ( opt && opt . replaysSessionSampleRate ) {
1381
+ if ( opt && typeof opt . replaysSessionSampleRate === 'number' ) {
1358
1382
this . options . sessionSampleRate = opt . replaysSessionSampleRate ;
1359
1383
}
1360
1384
1361
- if ( opt && opt . replaysOnErrorSampleRate ) {
1385
+ if ( opt && typeof opt . replaysOnErrorSampleRate === 'number' ) {
1362
1386
this . options . errorSampleRate = opt . replaysOnErrorSampleRate ;
1363
1387
}
1364
1388
}
0 commit comments