Skip to content

Commit 42d5710

Browse files
committed
ref(replay): Rename replaysSampleRate to replaysSessionSampleRate
We wanted this config option to be a bit more specific in that it should be the sample rate for "session" replays (vs. on error samples). The previous name could be mistaken as a sample rate that affects both types of replays.
1 parent 65f220b commit 42d5710

File tree

5 files changed

+11
-11
lines changed

5 files changed

+11
-11
lines changed

packages/browser/src/client.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ type BrowserClientReplayOptions = {
1313
* The sample rate for session-long replays.
1414
* 1.0 will record all sessions and 0 will record none.
1515
*/
16-
replaysSampleRate?: number;
16+
replaysSessionSampleRate?: number;
1717

1818
/**
1919
* The sample rate for sessions that has had an error occur.

packages/replay/MIGRATION.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ They are now defined on the top level of the SDK:
2424
```js
2525
Sentry.init({
2626
dsn: '__DSN__',
27-
replaysSampleRate: 0.1,
27+
replaysSessionSampleRate: 0.1,
2828
replaysOnErrorSampleRate: 1.0,
2929
integrations: [
3030
new Replay({

packages/replay/README.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ Sentry.init({
4848

4949
// This sets the sample rate to be 10%. You may want this to be 100% while
5050
// in development and sample at a lower rate in production
51-
replaysSampleRate: 0.1,
51+
replaysSessionSampleRate: 0.1,
5252

5353
// If the entire session is not sampled, use the below sample rate to sample
5454
// sessions when an error occurs.
@@ -101,10 +101,10 @@ Alternatively, rather than recording an entire session, you can capture a replay
101101

102102
Sampling allows you to control how much of your website's traffic will result in a Session Replay. There are two sample rates you can adjust to get the replays more relevant to your interests:
103103

104-
- `replaysSampleRate` - The sample rate for replays that begin recording immediately and last the entirety of the user's session.
104+
- `replaysSessionSampleRate` - The sample rate for replays that begin recording immediately and last the entirety of the user's session.
105105
- `replaysOnErrorSampleRate` - The sample rate for replays that are recorded when an error happens. This type of replay will record up to a minute of events prior to the error and continue recording until the session ends.
106106

107-
Sampling occurs when the session is first started. `replaysSampleRate` is evaluated first. If it is sampled, then the replay recording begins. Otherwise, `replaysOnErrorSampleRate` is evaluated and if it is sampled, the integration will begin buffering the replay and will only upload a replay to Sentry when an error occurs. The remainder of the replay will behave similarly to a whole-session replay.
107+
Sampling occurs when the session is first started. `replaysSessionSampleRate` is evaluated first. If it is sampled, then the replay recording begins. Otherwise, `replaysOnErrorSampleRate` is evaluated and if it is sampled, the integration will begin buffering the replay and will only upload a replay to Sentry when an error occurs. The remainder of the replay will behave similarly to a whole-session replay.
108108

109109

110110
## Configuration
@@ -116,7 +116,7 @@ The following options can be configured on the root level of your browser-based
116116

117117
| key | type | default | description |
118118
| ------------------- | ------- | ------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
119-
| replaysSampleRate | number | `0.1` | The sample rate for replays that begin recording immediately and last the entirety of the user's session. 1.0 will collect all replays, 0 will collect no replays. |
119+
| replaysSessionSampleRate | number | `0.1` | The sample rate for replays that begin recording immediately and last the entirety of the user's session. 1.0 will collect all replays, 0 will collect no replays. |
120120
| replaysOnErrorSampleRate | number | `1.0` |The sample rate for replays that are recorded when an error happens. This type of replay will record up to a minute of events prior to the error and continue recording until the session ends. 1.0 capturing all sessions with an error, and 0 capturing none.
121121

122122
### General Integration Configuration

packages/replay/src/index.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1354,8 +1354,8 @@ export class Replay implements Integration {
13541354
const client = getCurrentHub().getClient() as BrowserClient | undefined;
13551355
const opt = client && (client.getOptions() as BrowserOptions | undefined);
13561356

1357-
if (opt && opt.replaysSampleRate) {
1358-
this.options.sessionSampleRate = opt.replaysSampleRate;
1357+
if (opt && opt.replaysSessionSampleRate) {
1358+
this.options.sessionSampleRate = opt.replaysSessionSampleRate;
13591359
}
13601360

13611361
if (opt && opt.replaysOnErrorSampleRate) {

packages/replay/test/unit/index-integrationSettings.test.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -33,22 +33,22 @@ describe('blockAllMedia', () => {
3333
});
3434
});
3535

36-
describe('replaysSampleRate', () => {
36+
describe('replaysSessionSampleRate', () => {
3737
it('works with defining settings in integration', async () => {
3838
({ replay } = await mockSdk({ replayOptions: { sessionSampleRate: 0.5 } }));
3939

4040
expect(replay.options.sessionSampleRate).toBe(0.5);
4141
});
4242

4343
it('works with defining settings in SDK', async () => {
44-
({ replay } = await mockSdk({ sentryOptions: { replaysSampleRate: 0.5 } }));
44+
({ replay } = await mockSdk({ sentryOptions: { replaysSessionSampleRate: 0.5 } }));
4545

4646
expect(replay.options.sessionSampleRate).toBe(0.5);
4747
});
4848

4949
it('SDK option takes precedence', async () => {
5050
({ replay } = await mockSdk({
51-
sentryOptions: { replaysSampleRate: 0.5 },
51+
sentryOptions: { replaysSessionSampleRate: 0.5 },
5252
replayOptions: { sessionSampleRate: 0.1 },
5353
}));
5454

0 commit comments

Comments
 (0)