Skip to content

Commit

Permalink
feat(replay): Remove default sample rates for replay (#6878)
Browse files Browse the repository at this point in the history
Previously, they were:

* `replaysSessionSampleRate: 0.1`
* `replaysOnErrorSampleRate: 1.0`

Now, you have to explicitly set the sample rates, otherwise they default to 0.
  • Loading branch information
mydea authored Jan 23, 2023
1 parent d1ddeff commit f2e00b1
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 15 deletions.
10 changes: 10 additions & 0 deletions packages/replay/MIGRATION.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,13 @@
# Upgrading Replay from 7.31.0 to 7.32.0

In 7.32.0, we have removed the default values for the replay sample rates.
Previously, they were:

* `replaysSessionSampleRate: 0.1`
* `replaysOnErrorSampleRate: 1.0`

Now, you have to explicitly set the sample rates, otherwise they default to 0.

# Upgrading Replay from 0.6.x to 7.24.0

The Sentry Replay integration was moved to the Sentry JavaScript SDK monorepo. Hence we're jumping from version 0.x to the monorepo's 7.x version which is shared across all JS SDK packages.
Expand Down
6 changes: 0 additions & 6 deletions packages/replay/src/constants.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,12 +20,6 @@ export const VISIBILITY_CHANGE_TIMEOUT = SESSION_IDLE_DURATION;
// The maximum length of a session
export const MAX_SESSION_LIFE = 3_600_000; // 60 minutes

/**
* Defaults for sampling rates
*/
export const DEFAULT_SESSION_SAMPLE_RATE = 0.1;
export const DEFAULT_ERROR_SAMPLE_RATE = 1.0;

/** The select to use for the `maskAllText` option */
export const MASK_ALL_TEXT_SELECTOR = 'body *:not(style), body *:not(script)';

Expand Down
12 changes: 3 additions & 9 deletions packages/replay/src/integration.ts
Original file line number Diff line number Diff line change
@@ -1,13 +1,7 @@
import { getCurrentHub } from '@sentry/core';
import type { BrowserClientReplayOptions, Integration } from '@sentry/types';

import {
DEFAULT_ERROR_SAMPLE_RATE,
DEFAULT_FLUSH_MAX_DELAY,
DEFAULT_FLUSH_MIN_DELAY,
DEFAULT_SESSION_SAMPLE_RATE,
MASK_ALL_TEXT_SELECTOR,
} from './constants';
import { DEFAULT_FLUSH_MAX_DELAY, DEFAULT_FLUSH_MIN_DELAY, MASK_ALL_TEXT_SELECTOR } from './constants';
import { ReplayContainer } from './replay';
import type { RecordingOptions, ReplayConfiguration, ReplayPluginOptions } from './types';
import { isBrowser } from './util/isBrowser';
Expand Down Expand Up @@ -71,8 +65,8 @@ export class Replay implements Integration {
flushMinDelay,
flushMaxDelay,
stickySession,
sessionSampleRate: DEFAULT_SESSION_SAMPLE_RATE,
errorSampleRate: DEFAULT_ERROR_SAMPLE_RATE,
sessionSampleRate: 0,
errorSampleRate: 0,
useCompression,
maskAllText: typeof maskAllText === 'boolean' ? maskAllText : !maskTextSelector,
blockAllMedia,
Expand Down

0 comments on commit f2e00b1

Please sign in to comment.