File tree Expand file tree Collapse file tree 1 file changed +21
-1
lines changed
src/platform-includes/configuration/before-send-transaction Expand file tree Collapse file tree 1 file changed +21
-1
lines changed Original file line number Diff line number Diff line change 1
- In Python a function can be used to modify the transaction event or return a completely new one . If you return ` None ` , the event will be discarded.
1
+ In Python, a function can be used to modify the transaction event or return a new instance . If you return ` None ` , the event will be discarded.
2
2
3
3
``` python
4
4
import sentry_sdk
@@ -13,3 +13,23 @@ sentry_sdk.init(
13
13
before_send_transaction = strip_sensitive_data,
14
14
)
15
15
```
16
+
17
+ Addtionally, you may filter out transaction events based on the request URL, like ` /healthcheck ` .
18
+
19
+ ``` python
20
+ from urllib.parse import urlparse
21
+
22
+ def filter_transactions (event , hint ):
23
+ url_string = event[" request" ][" url" ]
24
+ parsed_url = urlparse(url_string)
25
+
26
+ if parsed_url.path == " /healthcheck" :
27
+ return None
28
+
29
+ return event
30
+
31
+ sentry_sdk.init(
32
+ # ...
33
+ before_send_transaction = filter_transactions,
34
+ )
35
+ ```
You can’t perform that action at this time.
0 commit comments