You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
* docs(python): Improve `before_send` docs
Improve the `before_send` Python docs by:
- Making the docs specific to Python, rather than general to all languages
- Using clearer, more precise language
- Providing a more concrete example
Also, move the content from `platform-includes/configuration/before-send/python.mdx` directly into `docs/platforms/python/configuration/filtering/index.mdx`, as it seems to only be used in that one place.
Closes#8474
* Apply suggestions from code review
Co-authored-by: Anton Pirker <[email protected]>
* Update docs/platforms/python/configuration/filtering/index.mdx
Co-authored-by: Liza Mock <[email protected]>
* Update docs/platforms/python/configuration/filtering/index.mdx
Co-authored-by: Ivana Kellyer <[email protected]>
---------
Co-authored-by: Anton Pirker <[email protected]>
Co-authored-by: Liza Mock <[email protected]>
Co-authored-by: Ivana Kellyer <[email protected]>
Copy file name to clipboardExpand all lines: docs/platforms/python/configuration/filtering/index.mdx
+34-2Lines changed: 34 additions & 2 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -16,9 +16,41 @@ Configure your SDK to filter error events by using the <PlatformIdentifier name=
16
16
17
17
### Using <PlatformIdentifiername="before-send" />
18
18
19
-
All Sentry SDKs support the <PlatformIdentifiername="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. <PlatformIdentifiername="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.
19
+
The `before_send`callback allows you to modify the event payload before the SDK sends the event to Sentry. You can also stop the event from being sent by returning `None`.
The callback receives two arguments: the event payload and a [hint](#event-hints). The callback can return either the event payload to send to Sentry or `None` if the event should be dropped.
22
+
23
+
Any modifications to the event payload done in the callback, including adding data to the event and modifying or deleting existing event fields, will be reflected in Sentry.
24
+
25
+
#### Example `before_send`
26
+
27
+
Suppose that you wish prevent all errors of type `ZeroDivisionError` from being sent to Sentry and that you want to set an additional data attribute called `"foo"` to `"bar"` on all other events. You can achieve this behavior with the following `before_send` callback.
0 commit comments