Skip to content

Commit 7bec613

Browse files
authored
feat(v8/replay): Remove deprecated replay options (#11268)
ref #9834 ref #10100 - Remove deprecated privacy options for replay - Add @sentry/replay changes to migration doc - Re-add back Replay migration doc
1 parent ade0410 commit 7bec613

File tree

8 files changed

+183
-208
lines changed

8 files changed

+183
-208
lines changed

MIGRATION.md

Lines changed: 17 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,7 @@ We've removed the following packages:
4949
- [@sentry/tracing](./MIGRATION.md#sentrytracing)
5050
- [@sentry/integrations](./MIGRATION.md#sentryintegrations)
5151
- [@sentry/serverless](./MIGRATION.md#sentryserverless)
52+
- [@sentry/replay](./MIGRATION.md#sentryreplay)
5253

5354
#### @sentry/hub
5455

@@ -217,6 +218,20 @@ Sentry.init({
217218
});
218219
```
219220

221+
#### @sentry/replay
222+
223+
`@sentry/replay` has been removed and will no longer be published. You can import replay functionality and the replay
224+
integration directly from the Browser SDK or browser framework-specific packages like `@sentry/react`.
225+
226+
```js
227+
// v7
228+
import { Replay } from '@sentry/replay';
229+
```
230+
231+
```js
232+
import { replayIntegration } from '@sentry/browser';
233+
```
234+
220235
## 3. Performance Monitoring Changes
221236

222237
- [Initializing the SDK in v8](./MIGRATION.md/#initializing-the-node-sdk)
@@ -1659,7 +1674,7 @@ Sentry.init({
16591674
## Replay options changed (since 7.35.0) - #6645
16601675

16611676
Some options for replay have been deprecated in favor of new APIs. See
1662-
[Replay Migration docs](./packages/replay/MIGRATION.md#upgrading-replay-from-7340-to-7350) for details.
1677+
[Replay Migration docs](./docs/migration/replay.md#upgrading-replay-from-7340-to-7350---6645) for details.
16631678

16641679
## Renaming of Next.js wrapper methods (since 7.31.0) - #6790
16651680

@@ -1697,4 +1712,4 @@ This release deprecates `@sentry/hub` and all of it's exports. All of the `@sent
16971712
# Upgrading Sentry Replay (beta, 7.24.0)
16981713

16991714
For details on upgrading Replay in its beta phase, please view the
1700-
[dedicated Replay MIGRATION docs](./packages/replay/MIGRATION.md).
1715+
[dedicated Replay MIGRATION docs](./docs/migration/replay.md).

docs/migration/replay.md

Lines changed: 156 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,156 @@
1+
# End of Replay Beta
2+
3+
Sentry Replay is now out of Beta. This means that the usual stability guarantees apply.
4+
5+
Because of experimentation and rapid iteration, during the Beta period some bugs and problems came up which have since
6+
been fixed/improved. We **strongly** recommend anyone using Replay in a version before 7.39.0 to update to 7.39.0 or
7+
newer, in order to prevent running Replay with known problems that have since been fixed.
8+
9+
Below you can find a list of relevant replay issues that have been resolved until 7.39.0:
10+
11+
## New features / improvements
12+
13+
- Remove `autoplay` attribute from audio/video tags ([#59](https://github.com/getsentry/rrweb/pull/59))
14+
- Exclude fetching scripts that use `<link rel="modulepreload">` ([#52](https://github.com/getsentry/rrweb/pull/52))
15+
- With maskAllText, mask the attributes: placeholder, title, `aria-label`
16+
- Lower the flush max delay from 15 seconds to 5 seconds (#6761)
17+
- Stop recording when retry fails (#6765)
18+
- Stop without retry when receiving bad API response (#6773)
19+
- Send client_report when replay sending fails (#7093)
20+
- Stop recording when hitting a rate limit (#7018)
21+
- Allow Replay to be used in Electron renderers with nodeIntegration enabled (#6644)
22+
- Do not renew session in error mode (#6948)
23+
- Remove default sample rates for replay (#6878)
24+
- Add `flush` method to integration (#6776)
25+
- Improve compression worker & fallback behavior (#6988, #6936, #6827)
26+
- Improve error handling (#7087, #7094, #7010, getsentry/rrweb#16, #6856)
27+
- Add more default block filters (#7233)
28+
29+
## Fixes
30+
31+
- Fix masking inputs on change when `maskAllInputs:false` ([#61](https://github.com/getsentry/rrweb/pull/61))
32+
- More robust `rootShadowHost` check ([#50](https://github.com/getsentry/rrweb/pull/50))
33+
- Fix duplicated textarea value ([#62](https://github.com/getsentry/rrweb/pull/62))
34+
- Handle removed attributes ([#65](https://github.com/getsentry/rrweb/pull/65))
35+
- Change LCP calculation (#7187, #7225)
36+
- Fix debounced flushes not respecting `maxWait` (#7207, #7208)
37+
- Fix svgs not getting unblocked (#7132)
38+
- Fix missing fetch/xhr requests (#7134)
39+
- Fix feature detection of PerformanceObserver (#7029)
40+
- Fix `checkoutEveryNms` (#6722)
41+
- Fix incorrect uncompressed recording size due to encoding (#6740)
42+
- Ensure dropping replays works (#6522)
43+
- Envelope send should be awaited in try/catch (#6625)
44+
- Improve handling of `maskAllText` selector (#6637)
45+
46+
# Upgrading Replay from 7.34.0 to 7.35.0 - #6645
47+
48+
This release will remove the ability to change the default rrweb recording options (outside of privacy options). The
49+
following are the new configuration values all replays will use: `slimDOMOptions: 'all'` - Removes `script`, comments,
50+
`favicon`, whitespace in `head`, and a few `meta` tags in `head` `recordCanvas: false` - This option did not do anything
51+
as playback of recorded canvas means we would have to remove the playback sandbox (which is a security concern).
52+
`inlineStylesheet: true` - Inlines styles into the recording itself instead of attempting to fetch it remotely. This
53+
means that styles in the replay will reflect the styles at the time of recording and not the current styles of the
54+
remote stylesheet. `collectFonts: true` - Attempts to load custom fonts. `inlineImages: false` - Does not inline images
55+
to recording and instead loads the asset remotely. During playback, images may not load due to CORS (add sentry.io as an
56+
origin).
57+
58+
Additionally, we have streamlined the privacy options. The following table lists the deprecated value, and what it is
59+
replaced by:
60+
61+
| deprecated key | replaced by | description |
62+
| ---------------- | ----------- | ------------------------------------------------------------------------------------------------------------------------------------------------ |
63+
| maskInputOptions | mask | Use CSS selectors in `mask` in order to mask all inputs of a certain type. For example, `input[type="address"]` |
64+
| blockSelector | block | The selector(s) can be moved directly in the `block` array. |
65+
| blockClass | block | Convert the class name to a CSS selector and add to `block` array. For example, `first-name` becomes `.first-name`. Regexes can be moved as-is. |
66+
| maskClass | mask | Convert the class name to a CSS selector and add to `mask` array. For example, `first-name` becomes `.first-name`. Regexes can be moved as-is. |
67+
| maskSelector | mask | The selector(s) can be moved directly in the `mask` array. |
68+
| ignoreClass | ignore | Convert the class name to a CSS selector and add to `ignore` array. For example, `first-name` becomes `.first-name`. Regexes can be moved as-is. |
69+
70+
# Upgrading Replay from 7.31.0 to 7.32.0
71+
72+
In 7.32.0, we have removed the default values for the replay sample rates. Previously, they were:
73+
74+
- `replaysSessionSampleRate: 0.1`
75+
- `replaysOnErrorSampleRate: 1.0`
76+
77+
Now, you have to explicitly set the sample rates, otherwise they default to 0.
78+
79+
# Upgrading Replay from 0.6.x to 7.24.0
80+
81+
The Sentry Replay integration was moved to the Sentry JavaScript SDK monorepo. Hence we're jumping from version 0.x to
82+
the monorepo's 7.x version which is shared across all JS SDK packages.
83+
84+
## Replay sample rates are defined on top level (https://github.com/getsentry/sentry-javascript/issues/6351)
85+
86+
Instead of defining the sample rates on the integration like this:
87+
88+
```js
89+
Sentry.init({
90+
dsn: '__DSN__',
91+
integrations: [
92+
new Replay({
93+
sessionSampleRate: 0.1,
94+
errorSampleRate: 1.0,
95+
}),
96+
],
97+
// ...
98+
});
99+
```
100+
101+
They are now defined on the top level of the SDK:
102+
103+
```js
104+
Sentry.init({
105+
dsn: '__DSN__',
106+
replaysSessionSampleRate: 0.1,
107+
replaysOnErrorSampleRate: 1.0,
108+
integrations: [
109+
new Replay({
110+
// other replay config still goes in here
111+
}),
112+
],
113+
});
114+
```
115+
116+
Note that the sample rate options inside of `new Replay({})` have been deprecated and will be removed in a future
117+
update.
118+
119+
## Removed deprecated options (https://github.com/getsentry/sentry-javascript/pull/6370)
120+
121+
Two options, which have been deprecated for some time, have been removed:
122+
123+
- `replaysSamplingRate` - instead use `sessionSampleRate`
124+
- `captureOnlyOnError` - instead use `errorSampleRate`
125+
126+
## New NPM package structure (https://github.com/getsentry/sentry-javascript/issues/6280)
127+
128+
The internal structure of the npm package has changed. This is unlikely to affect you, unless you have imported
129+
something from e.g.:
130+
131+
```js
132+
import something from '@sentry/replay/submodule';
133+
```
134+
135+
If you only imported from `@sentry/replay`, this will not affect you.
136+
137+
## Changed type name from `IEventBuffer` to `EventBuffer` (https://github.com/getsentry/sentry-javascript/pull/6416)
138+
139+
It is highly unlikely to affect anybody, but the type `IEventBuffer` was renamed to `EventBuffer` for consistency.
140+
Unless you manually imported this and used it somewhere in your codebase, this will not affect you.
141+
142+
## Session object is now a plain object (https://github.com/getsentry/sentry-javascript/pull/6417)
143+
144+
The `Session` object exported from Replay is now a plain object, instead of a class. This should not affect you unless
145+
you specifically accessed this class & did custom things with it.
146+
147+
## Reduce public API of Replay integration (https://github.com/getsentry/sentry-javascript/pull/6407)
148+
149+
The result of `new Replay()` now has a much more limited public API. Only the following methods are exposed:
150+
151+
```js
152+
const replay = new Replay();
153+
154+
replay.start();
155+
replay.stop();
156+
```

packages/replay-internal/README.md

Lines changed: 0 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -212,20 +212,6 @@ The following options can be configured as options to the integration, in `Sentr
212212
| unmask | Array<string> | [] | Unmask all elements that match the given DOM selectors. Useful when using `maskAllText`. See [privacy](#masking) section for an example. |
213213
| ignore | Array<string> | `.sentry-ignore, [data-sentry-ignore]` | Ignores all events on the matching input fields. See [privacy](#ignoring) section for an example. |
214214
215-
#### Deprecated options
216-
217-
In order to streamline our privacy options, the following have been deprecated in favor for the respective options
218-
above.
219-
220-
| deprecated key | replaced by | description |
221-
| ---------------- | ----------- | ------------------------------------------------------------------------------------------------------------------------------------------------ |
222-
| maskInputOptions | mask | Use CSS selectors in `mask` in order to mask all inputs of a certain type. For example, `input[type="address"]` |
223-
| blockSelector | block | The selector(s) can be moved directly in the `block` array. |
224-
| blockClass | block | Convert the class name to a CSS selector and add to `block` array. For example, `first-name` becomes `.first-name`. Regexes can be moved as-is. |
225-
| maskClass | mask | Convert the class name to a CSS selector and add to `mask` array. For example, `first-name` becomes `.first-name`. Regexes can be moved as-is. |
226-
| maskSelector | mask | The selector(s) can be moved directly in the `mask` array. |
227-
| ignoreClass | ignore | Convert the class name to a CSS selector and add to `ignore` array. For example, `first-name` becomes `.first-name`. Regexes can be moved as-is. |
228-
229215
## Privacy
230216
231217
There are several ways to deal with PII. By default, the integration will mask all text content with `*` and block all

packages/replay-internal/src/integration.ts

Lines changed: 1 addition & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -114,19 +114,6 @@ export class Replay implements Integration {
114114

115115
beforeAddRecordingEvent,
116116
beforeErrorSampling,
117-
118-
// eslint-disable-next-line deprecation/deprecation
119-
blockClass,
120-
// eslint-disable-next-line deprecation/deprecation
121-
blockSelector,
122-
// eslint-disable-next-line deprecation/deprecation
123-
maskInputOptions,
124-
// eslint-disable-next-line deprecation/deprecation
125-
maskTextClass,
126-
// eslint-disable-next-line deprecation/deprecation
127-
maskTextSelector,
128-
// eslint-disable-next-line deprecation/deprecation
129-
ignoreClass,
130117
}: ReplayConfiguration = {}) {
131118
this.name = Replay.id;
132119

@@ -136,17 +123,12 @@ export class Replay implements Integration {
136123
block,
137124
unblock,
138125
ignore,
139-
blockClass,
140-
blockSelector,
141-
maskTextClass,
142-
maskTextSelector,
143-
ignoreClass,
144126
});
145127

146128
this._recordingOptions = {
147129
maskAllInputs,
148130
maskAllText,
149-
maskInputOptions: { ...(maskInputOptions || {}), password: true },
131+
maskInputOptions: { password: true },
150132
maskTextFn: maskFn,
151133
maskInputFn: maskFn,
152134
maskAttributeFn: (key: string, value: string, el: HTMLElement): string =>

packages/replay-internal/src/types/replay.ts

Lines changed: 0 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -294,37 +294,9 @@ export interface ReplayIntegrationPrivacyOptions {
294294
maskFn?: (s: string) => string;
295295
}
296296

297-
export interface DeprecatedPrivacyOptions {
298-
/**
299-
* @deprecated Use `block` which accepts an array of CSS selectors
300-
*/
301-
blockSelector?: RecordingOptions['blockSelector'];
302-
/**
303-
* @deprecated Use `block` which accepts an array of CSS selectors
304-
*/
305-
blockClass?: RecordingOptions['blockClass'];
306-
/**
307-
* @deprecated Use `ignore` which accepts an array of CSS selectors
308-
*/
309-
ignoreClass?: RecordingOptions['ignoreClass'];
310-
/**
311-
* @deprecated Use `mask` which accepts an array of CSS selectors
312-
*/
313-
maskInputOptions?: RecordingOptions['maskInputOptions'];
314-
/**
315-
* @deprecated Use `mask` which accepts an array of CSS selectors
316-
*/
317-
maskTextClass?: RecordingOptions['maskTextClass'];
318-
/**
319-
* @deprecated Use `mask` which accepts an array of CSS selectors
320-
*/
321-
maskTextSelector?: RecordingOptions['maskTextSelector'];
322-
}
323-
324297
export interface ReplayConfiguration
325298
extends ReplayIntegrationPrivacyOptions,
326299
OptionalReplayPluginOptions,
327-
DeprecatedPrivacyOptions,
328300
Pick<RecordingOptions, 'maskAllText' | 'maskAllInputs'> {}
329301

330302
interface CommonEventContext {

0 commit comments

Comments
 (0)