Skip to content

Commit 60950b4

Browse files
martinhaintzvivianyentranbuenaflor
authored
add allowUrls and denyUrls for Flutter (#11067)
* add `allowUrls` and `denyUrls` for dart * moved allowUrls and denyUrls from dart to flutter * fix: use of regular expressions * Update docs/platforms/flutter/configuration/filtering.mdx Co-authored-by: vivianyentran <[email protected]> * Update docs/platforms/flutter/configuration/filtering.mdx Co-authored-by: vivianyentran <[email protected]> * Update docs/platforms/flutter/configuration/filtering.mdx Co-authored-by: vivianyentran <[email protected]> * Update platform-includes/configuration/allow-urls/dart.mdx Co-authored-by: Giancarlo Buenaflor <[email protected]> * Update platform-includes/configuration/deny-urls/dart.mdx Co-authored-by: Giancarlo Buenaflor <[email protected]> --------- Co-authored-by: vivianyentran <[email protected]> Co-authored-by: Giancarlo Buenaflor <[email protected]>
1 parent eed3973 commit 60950b4

File tree

3 files changed

+48
-0
lines changed

3 files changed

+48
-0
lines changed

docs/platforms/flutter/configuration/filtering.mdx

+22
Original file line numberDiff line numberDiff line change
@@ -65,6 +65,28 @@ When a string or a non-error object is raised, Sentry creates a synthetic except
6565

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

68+
#### Using `allowUrls` (Web only)
69+
70+
Based on the URL, you can narrow down whether events should be sent to Sentry.
71+
Using `allowUrls`, events are only sent if the URL matches the pattern specified in `allowUrls`.
72+
`allowUrls` accepts regular expressions.
73+
74+
If used on a platform other than Web, this setting will be ignored.
75+
76+
<PlatformContent includePath="configuration/allow-urls" />
77+
78+
#### Using `denyUrls` (Web only)
79+
80+
You can exclude events sent to Sentry based on the URL.
81+
Using `denyUrls`, events are ignored if the URL matches the pattern specified in `denyUrls`.
82+
`denyUrls` accepts regular expressions.
83+
84+
When used in combination with `allowUrls`, you can block specific subdomains of the domains listed in `allowUrls`.
85+
86+
If used on a platform other than Web, this setting will be ignored.
87+
88+
<PlatformContent includePath="configuration/deny-urls" />
89+
6890
## Filtering Transaction Events
6991

7092
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.
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
```dart
2+
import 'package:sentry/sentry.dart';
3+
4+
Future<void> main() async {
5+
await Sentry.init(
6+
(options) {
7+
options.dsn = '___PUBLIC_DSN___';
8+
options.allowUrls = ["^https://sentry.com.*\$", "my-custom-domain"];
9+
},
10+
appRunner: initApp, // Init your App.
11+
);
12+
}
13+
```
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
```dart
2+
import 'package:sentry/sentry.dart';
3+
4+
Future<void> main() async {
5+
await Sentry.init(
6+
(options) {
7+
options.dsn = '___PUBLIC_DSN___';
8+
options.denyUrls = ["^.*ends-with-this\$", "denied-url"];
9+
},
10+
appRunner: initApp, // Init your App.
11+
);
12+
}
13+
```

0 commit comments

Comments
 (0)