Skip to content

Commit 30dc4cb

Browse files
authored
add ignoreErrors and ignoreTransactions for Dart (#10989)
* add ignoreErrors and ignoreTransactions for Dart * improved misleading code samples for ignoreErrors and ignoreTransactions * removed unnecessary backslash from codesamples
1 parent f6d39b8 commit 30dc4cb

File tree

3 files changed

+32
-0
lines changed

3 files changed

+32
-0
lines changed

docs/platforms/dart/configuration/filtering.mdx

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,12 @@ We also offer [Inbound Filters](/concepts/data-management/filtering/) to filter
1414

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

17+
### Using <PlatformIdentifier name="ignore-errors" />
18+
19+
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.
20+
21+
<PlatformContent includePath="configuration/ignore-errors" />
22+
1723
### Using <PlatformIdentifier name="before-send" />
1824

1925
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.
@@ -69,6 +75,12 @@ When a string or a non-error object is raised, Sentry creates a synthetic except
6975

7076
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.
7177

78+
### Using <PlatformIdentifier name="ignore-transactions" />
79+
80+
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.
81+
82+
<PlatformContent includePath="configuration/ignore-transactions" />
83+
7284
### Using <PlatformIdentifier name="traces-sampler" />
7385

7486
**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.
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
```dart
2+
await SentryFlutter.init(
3+
(options) {
4+
options.dsn = '___PUBLIC_DSN___';
5+
options.ignoreErrors = ["my-error", "^error-.*\$"];
6+
...
7+
},
8+
appRunner: () => runApp(MyApp()),
9+
);
10+
```
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
```dart
2+
await SentryFlutter.init(
3+
(options) {
4+
options.dsn = '___PUBLIC_DSN___';
5+
options.ignoreTransactions = ["my-transaction", "^transaction-.*\$" ];
6+
...
7+
},
8+
appRunner: () => runApp(MyApp()),
9+
);
10+
```

0 commit comments

Comments
 (0)