Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add ignoreErrors and ignoreTransactions for Dart #10989

Merged
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
12 changes: 12 additions & 0 deletions docs/platforms/dart/configuration/filtering.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,12 @@ We also offer [Inbound Filters](/concepts/data-management/filtering/) to filter

Configure your SDK to filter error events by using the <PlatformIdentifier name="before-send" /> callback method and configuring, enabling, or disabling integrations.

### Using <PlatformIdentifier name="ignore-errors" />

You can use the <PlatformIdentifier name="ignore-errors" /> option to filter out errors that match a certain pattern. This option receives a list of strings and regular expressions to match against the error message. When using strings, partial matches will be filtered out. If you need to filter by exact match, use regex patterns instead.

<PlatformContent includePath="configuration/ignore-errors" />

### Using <PlatformIdentifier name="before-send" />

All Sentry SDKs support the <PlatformIdentifier name="before-send" /> callback method. Because it's called immediately before the event is sent to the server, this is your last chance to decide not to send data or to edit it. <PlatformIdentifier name="before-send" /> receives the event object as a parameter, which you can use to either modify the event’s data or drop it completely by returning `null`, based on custom logic and the data available on the event.
Expand Down Expand Up @@ -69,6 +75,12 @@ When a string or a non-error object is raised, Sentry creates a synthetic except

To prevent certain transactions from being reported to Sentry, use the <PlatformIdentifier name="traces-sampler" /> or <PlatformIdentifier name="before-send-transaction" /> configuration option, which allows you to provide a function to evaluate the current transaction and drop it if it's not one you want.

### Using <PlatformIdentifier name="ignore-transactions" />

You can use the <PlatformIdentifier name="ignore-transactions" /> option to filter out transactions that match a certain pattern. This option receives a list of strings and regular expressions to match against the transaction name. When using strings, partial matches will be filtered out. If you need to filter by exact match, use regex patterns instead.

<PlatformContent includePath="configuration/ignore-transactions" />

### Using <PlatformIdentifier name="traces-sampler" />

**Note:** The <PlatformIdentifier name="traces-sampler" /> and <PlatformIdentifier name="traces-sample-rate" /> config options are mutually exclusive. If you define a <PlatformIdentifier name="traces-sampler" /> to filter out certain transactions, you must also handle the case of non-filtered transactions by returning the rate at which you'd like them sampled.
Expand Down
10 changes: 10 additions & 0 deletions platform-includes/configuration/ignore-errors/dart.mdx
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
```dart
await SentryFlutter.init(
(options) {
options.dsn = '___PUBLIC_DSN___';
options.ignoreErrors = ["my-error", "^error-.*\$"];
...
},
appRunner: () => runApp(MyApp()),
);
```
10 changes: 10 additions & 0 deletions platform-includes/configuration/ignore-transactions/dart.mdx
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
```dart
await SentryFlutter.init(
(options) {
options.dsn = '___PUBLIC_DSN___';
options.ignoreTransactions = ["my-transaction", "^transaction-.*\$" ];
...
},
appRunner: () => runApp(MyApp()),
);
```
Loading