You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
replay(flutter): Update setup configuration and privacy configuration (#13982)
Makes it clearer how to set up to get additional data such as network
details and how to use it with third party widgets
---------
Co-authored-by: Jasmin <77064737+jas-kas@users.noreply.github.com>
| sessionSampleRate |`double`|`0`| The sample rate for replays that begin recording immediately and last the entirety of the user's session. `1.0` collects all replays, and `0` collects none. |
16
+
| onErrorSampleRate |`double`|`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` captures all sessions with an error, and `0` captures none. |
17
+
| quality |[SentryReplayQuality](https://pub.dev/documentation/sentry_flutter/latest/sentry_flutter/SentryReplayQuality.html)|`SentryReplayQuality.medium`| Defines the image quality of the session replay. The higher the quality, the more accurate the replay will be, but also more data to transfer and more CPU load. |
18
+
19
+
## Configure Network Details
20
+
21
+
In order to capture basic information about network requests, you need to use our Sentry integrations for the HTTP client you are using.
22
+
This allows the Sentry instrumented HTTP client to capture network details during your replay.
In order to capture screen names and navigation breadcrumbs, you need to add our `SentryNavigatorObserver` to your application's `navigatorObservers` and define route names when you navigate to a new screen.
30
+
31
+
Read more about how to configure the `SentryNavigatorObserver` in our [Routing Instrumentation](/platforms/dart/guides/flutter/integrations/routing-instrumentation/#configure) guide.
32
+
33
+
## Configure User Interactions
34
+
35
+
In order to capture user interaction breadcrumbs such as button taps, you need to wrap your root widget with `SentryWidget` and define unique keys for your buttons.
36
+
37
+
Read more about how to set up user interactions in our [User Interaction Instrumentation](/platforms/dart/guides/flutter/integrations/user-interaction-instrumentation/) guide.
Copy file name to clipboardExpand all lines: docs/platforms/dart/guides/flutter/session-replay/index.mdx
+7-10Lines changed: 7 additions & 10 deletions
Original file line number
Diff line number
Diff line change
@@ -18,7 +18,7 @@ By default, our Session Replay SDK masks all text content, images, and user inpu
18
18
19
19
## Pre-requisites
20
20
21
-
Make sure your Sentry Flutter SDK version is at least 9.0.0, which is required for Session Replay.
21
+
Make sure your Sentry Flutter SDK version is at least `9.0.0`, which is required for Session Replay.
22
22
You can update your `pubspec.yaml` to the matching version:
23
23
24
24
```yaml
@@ -33,6 +33,7 @@ To set up replay, enable it by setting a non-zero sample rate and wrapping your
33
33
```dart
34
34
await SentryFlutter.init(
35
35
(options) {
36
+
options.dsn = '__DSN__';
36
37
options.replay.sessionSampleRate = 1.0;
37
38
options.replay.onErrorSampleRate = 1.0;
38
39
},
@@ -60,17 +61,13 @@ Sampling allows you to control how much of your website's traffic will result in
60
61
61
62
Sampling starts as soon as a session begins. The `sessionSampleRate` is then evaluated. If the session is sampled, replay recording will start immediately. If not, `onErrorSampleRate` will be evaluated. If the session is sampled at this point, the replay will be buffered and will only be uploaded to Sentry if an error occurs.
62
63
63
-
## Redact Session Replay via `masking`
64
+
## PII & Privacy Considerations
64
65
65
-
By default, the SDK is recording and aggressively redacting (masking) all `Text`, `EditableText`, and `Image` widgets for <PlatformLink to="/session-replay/">`Session Replay`</PlatformLink>. To modify or disable this behavior, use the `options.privacy` parameter.
66
+
Personally identifiable information (PII), and privacy are important considerations when enabling Session Replay. The Sentry Flutter SDK aggressively masks all `Text`, `EditableText`, `RichText` and `Image` widgets by default.
66
67
67
-
<Alert level="warning">
68
-
Modifying this parameter will also affect `masking` for
While we have default privacy considerations in place, there are additional settings you might need to configure to fully mask your app's content.
69
+
We cannot detect the usage of third party widgets such as [FlutterMap](https://pub.dev/packages/flutter_map) so you need to manually configure the privacy configuration to mask the content of these widgets.
70
+
To learn more about session replay privacy, [read our docs.](/platforms/dart/guides/flutter/session-replay/privacy/)
Masking in the Sentry Flutter SDK is based on Widget _types_, e.g. `Image`, not the string representation of the type (i.e. we check whether
2
2
a `widgetInstance` should be masked by checking `if (widgetInstance is Image)` instead of `if (widgetInstance.runtimeType == 'Image')`).
3
3
This means we can ensure masking works regardless of obfuscation in release builds and also works for subclasses.
4
-
However, it also means we can only automatically mask widgets that are part of the Flutter SDK itself.
4
+
This approach allows the SDK to automatically mask widgets that are part of the Flutter SDK itself. However, for third-party widgets, you need to manually configure the privacy settings to mask their content. Read more about [Third Party Widgets](#third-party-widgets) below.
5
5
6
-
<Alertlevel="warning">
7
-
We cannot mask widgets defined in various 3rd-party packages (because the type is not known in the Sentry Flutter SDK),
8
-
even though many should be masked.
6
+
## Privacy Configuration
9
7
10
-
Therefore, you need to consider the widgets your application uses and ensure they're masked correctly with custom masking rules.
11
-
Examples of widgets that usually should be masked include (but are not limited to): VideoPlayer, WebView, Chart, etc.
8
+
The following options can be configured in the `options.privacy` field of your Sentry Flutter SDK, in `SentryFlutter.init((options) { ... })`:
| maskAllText |`bool`|`true`| Mask all text content. Draws a rectangle of text bounds with text color on top. Currently `Text`, `EditableText` and `RichText` widgets are masked. |
13
+
| maskAllImages |`bool`|`true`| Mask content of all images. Draws a rectangle of image bounds with image's dominant color on top. Currently `Image` widgets are masked. |
14
+
| maskAssetImages |`bool`|`true`| Mask asset images coming from the root asset bundle. |
15
+
| mask<T extends Widget>() |`void`| / | Mask given widget type `T` (or subclasses of `T`). Note: masking rules are called in the order they're added so if a previous rule already makes a decision, this rule won't be called. |
16
+
| unmask<T extends Widget>() |`void`| / | Unmask given widget type `T` (or subclasses of `T`). Note: masking rules are called in the order they're added so if a previous rule already makes a decision, this rule won't be called. |
17
+
| maskCallback<T extends Widget>() |`void`| / | Provide a custom callback to decide whether to mask the widget of class `T` (or subclasses of `T`). Note: masking rules are called in the order they're added so if a previous rule already makes a decision, this rule won't be called. |
14
18
15
-
You can tune this and add custom masking rules to fit your needs by adjusting the configuration in `options.privacy`.
16
19
For example, you can explicitly mask or unmask widgets by type,
17
20
or you can even have a callback to decide whether a specific widget instance should be masked:
Mask all text content. Draws a rectangle of text bounds with text color on top. Currently, only `Text` and `EditableText` Widgets are masked.
32
-
33
-
### `maskAllImages`
34
-
35
-
Mask content of all images. Draws a rectangle of image bounds with image's dominant color on top. Currently, only `Image` widgets are masked.
36
-
37
-
### `maskAssetImages`
38
-
39
-
Mask asset images coming from the root asset bundle.
40
-
41
-
### `mask<T extends Widget>()`
42
-
43
-
Mask given widget type `T` (or subclasses of `T`) in the screenshot. Note: masking rules are called in the order they're added so if a previous rule already makes a decision, this rule won't be called.
44
-
45
-
You can find more details in the documentation for each method.
46
-
47
32
<Alert>
48
33
49
34
If you find that data isn't being masked with the default settings, please let us know by creating a [GitHub issue](https://github.com/getsentry/sentry-dart/issues/new?template=BUG_REPORT.yml).
@@ -56,3 +41,14 @@ To disable masking for <PlatformLink to="/enriching-events/screenshots/">`Screen
56
41
options.privacy.maskAllText = false;
57
42
options.privacy.maskAllImages = false;
58
43
```
44
+
45
+
## Third Party Widgets
46
+
47
+
The Sentry Flutter SDK cannot automatically mask widgets from third party packages.
48
+
You need to manually configure the privacy configuration to mask the content of these widgets.
49
+
50
+
For example, if you are using the [FlutterMap](https://pub.dev/packages/flutter_map) package, you need to add the following privacy configuration:
0 commit comments