Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions docs/platforms/dart/common/configuration/filtering.mdx
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
---
title: Filtering
sidebar_order: 60
description: "Learn more about how to configure your Sentry Dart SDK to filter events reported to Sentry."
description: 'Learn more about how to configure your Sentry Dart SDK to filter events reported to Sentry.'
---

When you add Sentry to your app, you get a lot of valuable information about errors and performance. And lots of information is good -- as long as it's the right information, at a reasonable volume.
Expand Down Expand Up @@ -115,7 +115,7 @@ Use the <PlatformIdentifier name="before-send-span" /> configuration option to m
If you want to drop spans, use [<PlatformIdentifier name="ignore-spans" />](#using-ignore-spans).

```dart
options.beforeSendSpan = (span) {
options.beforeSendSpan = (span, hint) {
span.removeAttribute('http.request.body');
};
```
Expand Down
14 changes: 7 additions & 7 deletions docs/platforms/dart/common/configuration/options.mdx
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
---
title: Options
description: "Learn more about how the Sentry Dart SDK can be configured via options. These are being passed to the init function and therefore set when the SDK is first initialized."
description: 'Learn more about how the Sentry Dart SDK can be configured via options. These are being passed to the init function and therefore set when the SDK is first initialized.'
sidebar_order: 1
---

<PlatformContent includePath="configuration/config-intro" />

## Core Options

<TableOfContents ignoreIds={["core-options"]} />
<TableOfContents ignoreIds={['core-options']} />

Options that can be read from an environment variable (`SENTRY_DSN`, `SENTRY_ENVIRONMENT`, `SENTRY_RELEASE`) are read automatically.

Expand Down Expand Up @@ -64,7 +64,7 @@ By default the SDK will try to read this value from the `SENTRY_ENVIRONMENT` env

<SdkOption name="sampleRate" type="float" defaultValue="1.0">

Configures the sample rate for error events, in the range of `0.0` to `1.0`. The default is `1.0`, which means that 100% of error events will be sent. If set to `0.1`, only 10% of error events will be sent. Events are picked randomly.
Configures the sample rate for error events, in the range of `0.0` to `1.0`. The default is `1.0`, which means that 100% of error events will be sent. If set to `0.1`, only 10% of error events will be sent. Events are picked randomly. In v10, sampling happens after event processors and `beforeSend`, so these callbacks also run for events that are later sampled out.

</SdkOption>

Expand All @@ -74,11 +74,11 @@ This variable controls the total amount of breadcrumbs that should be captured.

</SdkOption>

<SdkOption name="attachStacktrace" type="bool" defaultValue="false">
<SdkOption name="attachStacktrace" type="bool" defaultValue="true">

When enabled, stack traces are automatically attached to all messages logged. Stack traces are always attached to exceptions; however, when this option is set, stack traces are also sent with messages. This option, for instance, means that stack traces appear next to all log messages.

This option is turned off by default.
This option is enabled by default.

Grouping in Sentry is different for events with stack traces and without. As a result, you will get new groups as you enable or disable this flag for certain events.

Expand Down Expand Up @@ -206,12 +206,12 @@ Only available in <PlatformLink to="/tracing/streamed-spans">stream mode</Platfo

</Alert>

This function is called with a span event object `SentrySpanV2` and can return a modified span object. Use it to scrub or modify span attributes before the span is sent to Sentry. Unlike other `beforeSend` callbacks, it can't drop spans — use [`ignoreSpans`](#ignoreSpans) for that.
In SDK v10, this function receives a `SentrySpanV2` and a `Hint`. Modify the span in place; the callback returns `void` or `Future<void>`. On SDK v9, it takes only the span parameter. Use it to scrub or modify span attributes before the span is sent to Sentry. Unlike other `beforeSend` callbacks, it can't drop spans — use [`ignoreSpans`](#ignoreSpans) for that.

<Expandable title="Examples">

```dart
options.beforeSendSpan = (span) {
options.beforeSendSpan = (span, hint) {
span.removeAttribute('http.request.body');
};
```
Expand Down
20 changes: 9 additions & 11 deletions docs/platforms/dart/common/tracing/streamed-spans/index.mdx
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
---
title: Streamed Spans
description: "Learn how to use stream mode to send spans to Sentry as they finish, removing the 1,000-span limit and making trace data visible sooner."
description: 'Learn how to use stream mode to send spans to Sentry as they finish, removing the 1,000-span limit and making trace data visible sooner.'
sidebar_order: 10
new: true
---
Expand Down Expand Up @@ -40,8 +40,7 @@ Trace

You need:

- <PlatformLink to="/tracing/#configure">Tracing configured</PlatformLink> in
your app
- <PlatformLink to="/tracing/#configure">Tracing configured</PlatformLink> in your app
- Sentry SDK `>=9.23.0`

## Migrate from Transaction Mode
Expand Down Expand Up @@ -90,14 +89,13 @@ Use only the APIs for the tracing mode you choose. Calls to APIs from the other
- In `stream` mode, transaction APIs (`Sentry.startTransaction`, `ISentrySpan.startChild`) are ignored.
- In `static` mode, the new span APIs (`Sentry.startSpan`, `Sentry.startSpanSync`, and `Sentry.startInactiveSpan`) are ignored.

<PlatformSection notSupported={["dart.flutter"]}>
Auto-instrumentations switch to the correct API automatically based on this
setting.
<PlatformSection notSupported={['dart.flutter']}>
Auto-instrumentations switch to the correct API automatically based on this setting.
</PlatformSection>
<PlatformSection supported={["dart.flutter"]}>
Auto-instrumentations switch to the correct API automatically based on this
setting. This includes Flutter's frames tracking, app start, TTID/TTFD,
navigation, user interaction, HTTP, database, and GraphQL instrumentations.
<PlatformSection supported={['dart.flutter']}>
Auto-instrumentations switch to the correct API automatically based on this setting.
This includes Flutter's frames tracking, app start, TTID/TTFD, navigation, user
interaction, HTTP, database, and GraphQL instrumentations.
</PlatformSection>

<Expandable title="How does span flushing work?">
Expand Down Expand Up @@ -420,7 +418,7 @@ To modify or redact span data before it's sent, use `beforeSendSpan`:
<SplitSectionCode>

```dart
options.beforeSendSpan = (span) {
options.beforeSendSpan = (span, hint) {
span.removeAttribute('http.request.body');
};
```
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
---
title: Migrate to Stream Mode
sidebar_order: 10
description: "Learn how to migrate your custom instrumentation from transaction mode to stream mode."
description: 'Learn how to migrate your custom instrumentation from transaction mode to stream mode.'
---

Stream mode replaces the transaction-based APIs with new span APIs. If you use custom instrumentation (creating transactions manually, setting span data, or filtering spans) you'll need to update that code before switching to stream mode. This guide walks through the changes.
Expand Down Expand Up @@ -131,7 +131,7 @@ Manual assignment is only needed to override the automatic default.
- // scrub sensitive data, drop transactions by name, etc.
- return transaction;
- };
+ options.beforeSendSpan = (span) {
+ options.beforeSendSpan = (span, hint) {
+ span.removeAttribute('http.request.body');
+ };
+ options.ignoreSpans = [
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
---
title: Filtering
sidebar_order: 60
description: "Learn more about how to configure your Sentry Flutter SDK to filter events reported to Sentry."
description: 'Learn more about how to configure your Sentry Flutter SDK to filter events reported to Sentry.'
---

When you add Sentry to your app, you get a lot of valuable information about errors and performance. And lots of information is good -- as long as it's the right information, at a reasonable volume.
Expand Down Expand Up @@ -145,7 +145,7 @@ Use the <PlatformIdentifier name="before-send-span" /> configuration option to m
If you want to drop spans, use [<PlatformIdentifier name="ignore-spans" />](#using-ignore-spans).

```dart
options.beforeSendSpan = (span) {
options.beforeSendSpan = (span, hint) {
span.removeAttribute('http.request.body');
};
```
Expand Down
42 changes: 15 additions & 27 deletions docs/platforms/dart/guides/flutter/configuration/options.mdx
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
---
title: Options
description: "Learn more about how the Sentry Flutter SDK can be configured via options. These are being passed to the init function and therefore set when the SDK is first initialized."
description: 'Learn more about how the Sentry Flutter SDK can be configured via options. These are being passed to the init function and therefore set when the SDK is first initialized.'
sidebar_order: 1
---

<PlatformContent includePath="configuration/config-intro" />

## Core Options

<TableOfContents ignoreIds={["core-options"]} />
<TableOfContents ignoreIds={['core-options']} />

Options that can be read from an environment variable (`SENTRY_DSN`, `SENTRY_ENVIRONMENT`, `SENTRY_RELEASE`) are read automatically.

Expand Down Expand Up @@ -64,7 +64,7 @@ By default the SDK will try to read this value from the `SENTRY_ENVIRONMENT` env

<SdkOption name="sampleRate" type="float" defaultValue="1.0">

Configures the sample rate for error events, in the range of `0.0` to `1.0`. The default is `1.0`, which means that 100% of error events will be sent. If set to `0.1`, only 10% of error events will be sent. Events are picked randomly.
Configures the sample rate for error events, in the range of `0.0` to `1.0`. The default is `1.0`, which means that 100% of error events will be sent. If set to `0.1`, only 10% of error events will be sent. Events are picked randomly. In v10, sampling happens after event processors and `beforeSend`, so these callbacks also run for events that are later sampled out.

</SdkOption>

Expand All @@ -84,7 +84,7 @@ The maximum number of [envelopes](https://develop.sentry.dev/sdk/data-model/enve

When enabled, stack traces are automatically attached to all messages logged. Stack traces are always attached to exceptions; however, when this option is set, stack traces are also sent with messages. This option, for instance, means that stack traces appear next to all log messages.

This option is turned off by default.
This option is enabled by default.

Grouping in Sentry is different for events with stack traces and without. As a result, you will get new groups as you enable or disable this flag for certain events.

Expand Down Expand Up @@ -114,12 +114,6 @@ Most SDKs will attempt to auto-discover this value.

</SdkOption>

<SdkOption name="autoSessionTracking" type="bool" defaultValue="true">

When set to `true`, the SDK will send session events to Sentry. This is supported in all browser SDKs, emitting one session per pageload and page navigation to Sentry. In mobile SDKs, when the app goes to the background for longer than 30 seconds, sessions are ended.

</SdkOption>

<SdkOption name="considerInAppFramesByDefault" type="bool">

Configures whether stack trace frames are considered as in app frames by default.
Expand All @@ -131,19 +125,19 @@ This value is used only if Sentry can not find the origin of the frame.

</SdkOption>

<SdkOption name="inAppInclude" type="array">
<SdkOption name="inAppIncludes" type="array">

A list of string prefixes of module names that belong to the app. This option takes precedence over `in-app-exclude`.

Sentry differentiates stack frames that are directly related to your application ("in application") from stack frames that come from other packages such as the standard library, frameworks, or other dependencies. The application package is automatically marked as `inApp`. The difference is visible in [sentry.io](https://sentry.io), where only the "in application" frames are displayed by default.

</SdkOption>

<SdkOption name="inAppExclude" type="array">
<SdkOption name="inAppExcludes" type="array">

A list of string prefixes of module names that do not belong to the app, but rather to third-party packages. Modules considered not part of the app will be hidden from stack traces by default.

This option can be overridden using <PlatformIdentifier name="inAppInclude" />.
This option can be overridden using <PlatformIdentifier name="inAppIncludes" />.

</SdkOption>

Expand Down Expand Up @@ -233,12 +227,12 @@ Only available in <PlatformLink to="/tracing/streamed-spans">stream mode</Platfo

</Alert>

This function is called with a span event object `SentrySpanV2` and can return a modified span object. Use it to scrub or modify span attributes before the span is sent to Sentry. Unlike other `beforeSend` callbacks, it can't drop spans — use [`ignoreSpans`](#ignoreSpans) for that.
In SDK v10, this function receives a `SentrySpanV2` and a `Hint`. Modify the span in place; the callback returns `void` or `Future<void>`. On SDK v9, it takes only the span parameter. Use it to scrub or modify span attributes before the span is sent to Sentry. Unlike other `beforeSend` callbacks, it can't drop spans — use [`ignoreSpans`](#ignoreSpans) for that.

<Expandable title="Examples">

```dart
options.beforeSendSpan = (span) {
options.beforeSendSpan = (span, hint) {
span.removeAttribute('http.request.body');
};
```
Expand Down Expand Up @@ -344,22 +338,16 @@ Controls whether the SDK should propagate the W3C `traceparent` HTTP header alon

</SdkOption>

<SdkOption name="enableStandaloneAppStartTracing" type="bool" defaultValue="false" availableSince="9.26.0">

Set this boolean to `true` to report the app start as its own `app.start` transaction instead of attaching it to the first `ui.load` transaction. Requires tracing to be enabled and is only supported on Android and iOS. This option is experimental. Learn more in our <PlatformLink to="/integrations/app-start-instrumentation/#standalone-app-start-tracing">App Start Instrumentation</PlatformLink> docs.
App start is automatically reported as a standalone `app.start` root on Android and iOS when tracing is enabled. See <PlatformLink to="/integrations/app-start-instrumentation/">App Start Instrumentation</PlatformLink> for sampling and extension APIs.

</SdkOption>

## Experimental Features
## Hybrid SDK Options

<SdkOption name="experimental" type="object">
<SdkOption name="captureNativeFailedRequests" type="bool" defaultValue="false">

An optional property that configures which features are in experimental mode. This property is either an `Object Type` with properties or a key/value `TypedDict`, depending the language. Experimental features are still in-progress and may have bugs. We recognize the irony.
Set this option to `true` to capture failed HTTP requests made by the native iOS and macOS SDK's network instrumentation. It is independent of `captureFailedRequests`, which controls Dart-side capture through `SentryHttpClient` and `sentry_dio`. The option is non-nullable in v10 and no longer falls back to `captureFailedRequests`.

</SdkOption>

## Hybrid SDK Options

<SdkOption name="autoInitializeNativeSdk" type="bool" defaultValue="true">

Set this boolean to `false` to disable the auto initialization of the native layer SDK. Doing so means you will need to initialize the native SDK manually. Do not use this to disable the native layer.
Expand All @@ -380,9 +368,9 @@ Set this boolean to `false` to disable the [release health](/product/releases/he

</SdkOption>

<SdkOption name="sessionTrackingIntervalMillis" type="int" defaultValue="30000">
<SdkOption name="autoSessionTrackingInterval" type="Duration" defaultValue="Duration(seconds: 30)">

Set this to change the default interval to end a session (release health) if the app goes to the background. Default is 30,000.
Sets how long the app can remain in the background before the SDK ends the session. For example, use `options.autoSessionTrackingInterval = const Duration(seconds: 60);` for a one-minute interval.

</SdkOption>

Expand Down
8 changes: 6 additions & 2 deletions docs/platforms/dart/guides/flutter/configuration/releases.mdx
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
---
title: Releases & Health
description: "Learn how to configure your Sentry Flutter SDK to tell Sentry about your releases."
description: 'Learn how to configure your Sentry Flutter SDK to tell Sentry about your releases.'
sidebar_order: 40
---

Expand Down Expand Up @@ -33,6 +33,10 @@ In order to monitor release health, the SDK sends session data.

### Sessions

A session represents the interaction between the user and the application. Sessions contain a timestamp, a status (if the session was OK or if it crashed), and are always linked to a release. Most Sentry SDKs can manage sessions automatically.
A session represents the interaction between the user and the application. Sessions include timestamps and health information and are linked to a release. The SDK manages sessions automatically by default.

On Android, iOS, and macOS, v10 records unhandled Flutter errors as unhandled, non-terminating errors instead of marking the session as crashed. Native crashes that terminate the process are still crashes. Unhandled Flutter errors dropped by `sampleRate` also update release health, so reducing the error sample rate does not hide those errors from session health. Events dropped by your event processors or `beforeSend` do not follow this sampling path.

Account for this change when comparing crash-free metrics before and after upgrading.

<PlatformContent includePath="configuration/auto-session-tracking" />
10 changes: 6 additions & 4 deletions docs/platforms/dart/guides/flutter/configuration/sampling.mdx
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
---
title: Sampling
sidebar_order: 50
description: "Learn how to configure the volume of error and transaction events sent to Sentry using the Flutter SDK."
description: 'Learn how to configure the volume of error and transaction events sent to Sentry using the Flutter SDK.'
---

Adding Sentry to your app gives you a great deal of very valuable information about errors and performance you wouldn't otherwise get. And lots of information is good -- as long as it's the right information, at a reasonable volume.
Expand All @@ -12,7 +12,9 @@ To send a representative sample of your errors to Sentry, set the <PlatformIdent

<PlatformContent includePath="configuration/sample-rate" />

The error sample rate defaults to `1`, meaning all errors are sent to Sentry.
The error sample rate defaults to `1`, meaning all errors are sent to Sentry. In v10, the sampling decision runs after event processors and `beforeSend`. These callbacks still run for events that are later sampled out.

On Android, iOS, and macOS, unhandled errors dropped by `sampleRate` still update <PlatformLink to="/configuration/releases/#sessions">release health</PlatformLink>.

<Alert>

Expand Down Expand Up @@ -45,8 +47,8 @@ The Sentry SDKs have two configuration options to control the volume of transact

2. Sampling function (<PlatformIdentifier name="traces-sampler" />) which:
- Samples different transactions/service spans at different rates
- <PlatformLink to="/configuration/filtering/">Filters</PlatformLink> out
some transactions entirely
- <PlatformLink to="/configuration/filtering/">Filters</PlatformLink> out some
transactions entirely
- Modifies default [precedence](#precedence) and [inheritance](#inheritance) behavior

By default, none of these options are set, meaning no transactions/service spans will be sent to Sentry. You must set either one of the options to start sending them.
Expand Down
Loading
Loading