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 allowUrls and denyUrls for Flutter #11067

Merged
22 changes: 22 additions & 0 deletions docs/platforms/flutter/configuration/filtering.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,28 @@ When a string or a non-error object is raised, Sentry creates a synthetic except

<PlatformContent includePath="configuration/breadcrumb-hints" />

#### Using `allowUrls` (Web only)

Based on the URL, you can narrow down whether events should be sent to Sentry.
Using `allowUrls`, events are only sent if the URL matches the pattern specified in `allowUrls`.
`allowUrls` accepts regular expressions.

If used on a platform other than Web, this setting will be ignored.

<PlatformContent includePath="configuration/allow-urls" />

#### Using `denyUrls` (Web only)

You can exclude events sent to Sentry based on the URL.
Using `denyUrls`, events are ignored if the URL matches the pattern specified in `denyUrls`.
`denyUrls` accepts regular expressions.

When used in combination with `allowUrls`, you can block specific subdomains of the domains listed in `allowUrls`.

If used on a platform other than Web, this setting will be ignored.

<PlatformContent includePath="configuration/deny-urls" />

## Filtering Transaction Events

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.
Expand Down
13 changes: 13 additions & 0 deletions platform-includes/configuration/allow-urls/dart.mdx
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
```dart
import 'package:sentry/sentry.dart';

Future<void> main() async {
await Sentry.init(
(options) {
options.dsn = '___PUBLIC_DSN___';
options.allowUrls = ["^https://sentry.com.*\$", "my-custom-domain"];
},
appRunner: initApp, // Init your App.
);
}
```
13 changes: 13 additions & 0 deletions platform-includes/configuration/deny-urls/dart.mdx
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
```dart
import 'package:sentry/sentry.dart';

Future<void> main() async {
await Sentry.init(
(options) {
options.dsn = '___PUBLIC_DSN___';
options.denyUrls = ["^.*ends-with-this\$", "denied-url"];
},
appRunner: initApp, // Init your App.
);
}
```
Loading