@sentry/replay 7.49.0 → 7.50.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -86,9 +86,9 @@ import * as Sentry from "@sentry/browser";
86
86
  Sentry.setUser({ email: "jane.doe@example.com" });
87
87
  ```
88
88
 
89
- ### Stopping & re-starting replays
89
+ ### Stopping & starting Replays manually
90
90
 
91
- Replay recording only starts when it is included in the `integrations` array when calling `Sentry.init` or calling `addIntegration` from the a Sentry client instance. To stop recording you can call the `stop()`.
91
+ Replay recording only starts when it is included in the `integrations` array when calling `Sentry.init` or calling `addIntegration` from the a Sentry client instance. To stop recording you can call `stop()`.
92
92
 
93
93
  ```js
94
94
  import * as Sentry from "@sentry/react";
@@ -109,6 +109,16 @@ client?.addIntegration(replay);
109
109
  replay.stop();
110
110
  ```
111
111
 
112
+ When both `replaysSessionSampleRate` and `replaysOnErrorSampleRate` are `0`, recording will _not_ start.
113
+ In this case, you can manually start recording:
114
+
115
+ ```js
116
+ replay.start(); // Will start a session in "session" mode, regardless of sample rates
117
+ replay.startBuffering(); // Will start a session in "buffer" mode, regardless of sample rates
118
+ ```
119
+
120
+
121
+
112
122
  ## Loading Replay as a CDN Bundle
113
123
 
114
124
  As an alternative to the NPM package, you can use Replay as a CDN bundle.
@@ -154,8 +164,11 @@ Sampling allows you to control how much of your website's traffic will result in
154
164
  - `replaysSessionSampleRate` - The sample rate for replays that begin recording immediately and last the entirety of the user's session.
155
165
  - `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.
156
166
 
157
- 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.
158
-
167
+ When Replay is initialized, we check the `replaysSessionSampleRate`.
168
+ If it is sampled, then we start recording & sending Replay data immediately.
169
+ Else, if `replaysOnErrorSampleRate > 0`, we'll start recording in buffering mode.
170
+ In this mode, whenever an error occurs we'll check `replaysOnErrorSampleRate`.
171
+ If it is sampled, when we'll upload the Replay to Sentry and continue recording normally.
159
172
 
160
173
  ## Configuration
161
174
 
@@ -234,5 +247,5 @@ This should not happen to often, but be aware that it is theoretically possible.
234
247
  ## Manually sending replay data
235
248
 
236
249
  You can use `replay.flush()` to immediately send all currently captured replay data.
237
- This can be combined with `replaysOnErrorSampleRate: 1`
238
- in order to be able to send the last 60 seconds of replay data on-demand.
250
+ When Replay is currently in buffering mode, this will send up to the last 60 seconds of replay data,
251
+ and also continue sending afterwards, similar to when an error happens & is recorded.