-
-
Notifications
You must be signed in to change notification settings - Fork 1.6k
ref(filtering): Revamp SDK filtering docs #5804
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
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,19 @@ | ||
| `originalException` | ||
|
|
||
| : The original exception that caused the Sentry SDK to create the event. This is useful for changing how the Sentry SDK groups events or to extract additional information. Available in error events. | ||
|
|
||
| `syntheticException` | ||
|
|
||
| : When a string or a non-error object is raised, Sentry creates a synthetic exception so you can get a basic stack trace. This exception is stored here for further data extraction. Available in error events. | ||
|
|
||
| `captureContext` | ||
|
|
||
| : Additional scope data passed as a second parameter to `captureMessage` and a third parameter to `captureException` and `captureEvent`. Available in message and error events. | ||
|
|
||
| `attachments` | ||
|
|
||
| : Files to be attached to the outgoing event. Available in message and error events. | ||
|
|
||
| Custom Data | ||
|
|
||
| : Any other data passed in the second parameter to `captureException` or `captureEvent`. Available in message and error events. |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,19 @@ | ||
| `originalException` | ||
|
|
||
| : The original exception that caused the Sentry SDK to create the event. This is useful for changing how the Sentry SDK groups events or to extract additional information. Available in error events. | ||
|
|
||
| `syntheticException` | ||
|
|
||
| : When a string or a non-error object is raised, Sentry creates a synthetic exception so you can get a basic stack trace. This exception is stored here for further data extraction. Available in error events. | ||
|
|
||
| `captureContext` | ||
|
|
||
| : Additional scope data passed as a second parameter to `captureMessage` and a third parameter to `captureException` and `captureEvent`. Available in message and error events. | ||
|
|
||
| `attachments` | ||
|
|
||
| : Files to be attached to the outgoing event. Available in message and error events. | ||
|
|
||
| Custom Data | ||
|
|
||
| : Any other data passed in the second parameter to `captureException` or `captureEvent`. Available in message and error events. |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,19 @@ | ||
| `originalException` | ||
|
|
||
| : The original exception that caused the Sentry SDK to create the event. This is useful for changing how the Sentry SDK groups events or to extract additional information. Available in error events. | ||
|
|
||
| `syntheticException` | ||
|
|
||
| : When a string or a non-error object is raised, Sentry creates a synthetic exception so you can get a basic stack trace. This exception is stored here for further data extraction. Available in error events. | ||
|
|
||
| `captureContext` | ||
|
|
||
| : Additional scope data passed as a second parameter to `captureMessage` and a third parameter to `captureException` and `captureEvent`. Available in message and error events. | ||
|
|
||
| `attachments` | ||
|
|
||
| : Files to be attached to the outgoing event. Available in message and error events. | ||
|
|
||
| Custom Data | ||
|
|
||
| : Any other data passed in the second parameter to `captureException` or `captureEvent`. Available in message and error events. |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,11 @@ | ||
| `exc_info` | ||
|
|
||
| : If you set this hint, then it's an exc info tuple in the form `(exc_type, exc_value, tb)`. This can be used to extract additional information from the original error object. | ||
|
|
||
| `log_record` | ||
|
|
||
| : This hint is passed to breadcrumbs and contains the log record that created it. It can be used to extract additional information from the original `logging` log record that is not extracted by default. Likewise, it can be useful to discard uninteresting breadcrumbs. | ||
|
|
||
| `httplib_request` | ||
|
|
||
| : An `httplib` request object for breadcrumbs created from HTTP requests. |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,15 @@ | ||
| `event` | ||
|
|
||
| : For breadcrumbs created from browser events, the Sentry SDK often supplies the event to the breadcrumb as a hint. This can be used to extract data from the target DOM element into a breadcrumb, for example. | ||
|
|
||
| `level` / `input` | ||
|
|
||
| : For breadcrumbs created from console log interceptions. This holds the original console log level and the original input data to the log function. | ||
|
|
||
| `response` / `input` | ||
|
|
||
| : For breadcrumbs created from HTTP requests. This holds the response object (from the fetch API) and the input parameters to the fetch function. | ||
|
|
||
| `xhr` | ||
|
|
||
| : For breadcrumbs created from HTTP requests made using the legacy `XMLHttpRequest` API. This holds the original `xhr` object. |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,29 @@ | ||
| --- | ||
| title: Hints | ||
| sidebar_order: 900 | ||
| description: "Learn about what's included in Event and Breadcrumb hints." | ||
| notSupported: | ||
| - apple | ||
| - dotnet | ||
| - perl | ||
| --- | ||
|
|
||
| # Hints | ||
|
|
||
| Event and Breadcrumb hints are objects containing information used to put together an event or a breadcrumb. These hints are passed as the `hint` parameter to `before_send`, `before_breadcrumb`, and event processors. | ||
|
|
||
| ## Event Hints | ||
|
|
||
| Hints for events have the following properties: | ||
|
|
||
| `eventId` | ||
|
|
||
| : A unique identifier for the event, searchable in the Sentry UI. Available in message and error events. | ||
|
|
||
| <PlatformContent includePath="configuration/before-send-hint-contents" /> | ||
|
|
||
| ## Hints for Breadcrumbs | ||
|
|
||
| Hints for breadcrumbs have the following properties: | ||
|
|
||
| <PlatformContent includePath="configuration/breadcrumb-hint-contents" /> | ||
| Original file line number | Diff line number | Diff line change | ||||
|---|---|---|---|---|---|---|
|
|
@@ -14,68 +14,47 @@ We also offer [Inbound Filters](/product/data-management-settings/filtering/) to | |||||
|
|
||||||
| ## Filtering Error Events | ||||||
|
|
||||||
| Configure your SDK to filter error events by using the <PlatformIdentifier name="before-send" /> callback method and configuring, enabling, or disabling integrations. | ||||||
| You can configure your SDK to filter events in a number of ways: | ||||||
|
|
||||||
| - by using the <PlatformIdentifier name="before-send" /> callback method | ||||||
| - by using event processors, | ||||||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
|
||||||
| - by configuring, enabling, or disabling integrations. | ||||||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
|
||||||
|
|
||||||
| ### Using <PlatformIdentifier name="before-send" /> | ||||||
|
|
||||||
| All Sentry SDKs support the <PlatformIdentifier name="before-send" /> callback method. <PlatformIdentifier name="before-send" /> is called immediately before the event is sent to the server, so it’s the final place where you can edit its data. It receives the event object as a parameter, so you can use that to modify the event’s data or drop it completely (by returning `null`) based on custom logic and the data available on the event. | ||||||
| All Sentry SDKs support the <PlatformIdentifier name="before-send" /> callback method. <PlatformIdentifier name="before-send" /> is called immediately before the event is sent to the server, so it's the final place you can edit an event's data. It receives the event object as a parameter, which you can use to modify the event's data or to drop the event completely (by returning `null`) based on custom logic and the data available on the event. | ||||||
|
|
||||||
| <PlatformContent includePath="configuration/before-send" /> | ||||||
|
|
||||||
| Note also that breadcrumbs can be filtered, as discussed in [our Breadcrumbs documentation](/product/error-monitoring/breadcrumbs/). | ||||||
|
|
||||||
| <PlatformSection notSupported={["apple", "dotnet"]}> | ||||||
|
|
||||||
| #### Event Hints | ||||||
|
|
||||||
| The <PlatformIdentifier name="before-send" /> callback is passed both the `event` and a second argument, `hint`, that holds one or more hints. | ||||||
|
|
||||||
| Typically a `hint` holds the original exception so that additional data can be extracted or grouping is affected. In this example, the fingerprint is forced to a common value if an exception of a certain type has been caught: | ||||||
|
|
||||||
| <PlatformContent includePath="configuration/before-send-hint" /> | ||||||
|
|
||||||
| When the SDK creates an event or breadcrumb for transmission, that transmission is typically created from some sort of source object. For instance, an error event is typically created from a log record or exception instance. For better customization, SDKs send these objects to certain callbacks (<PlatformIdentifier name="before-send" />, <PlatformIdentifier name="before-breadcrumb" /> or the event processor system in the SDK). | ||||||
|
|
||||||
| </PlatformSection> | ||||||
|
|
||||||
| <PlatformSection notSupported={["native", "apple", "dotnet"]}> | ||||||
| ### Hints | ||||||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This section doesn't seem to be about event processors. Is this supposed to undergo more changes? |
||||||
|
|
||||||
| ### Using Hints | ||||||
| Both event processors and the <PlatformIdentifier name="before-send" /> callback are passed two parameters: the event object and a second argument, `hint`, which holds extra data about the event. Similarly, <PlatformIdentifier name="before-breadcrumb" /> is passed the breadcrumb and a `hint` object. | ||||||
|
|
||||||
| Hints are available in two places: | ||||||
| When the SDK creates an event or breadcrumb, it's typically created from some sort of source object. For instance, a message event is typically created from a log record and an error event is typically created from an exception instance. Breadcrumbs may be created from XHR requests or user interactions. For better customization, SDKs pass these objects - the message which was logged, the exception which was thrown, the XHR request object, the DOM element and event name, etc. - in the hint. | ||||||
|
|
||||||
| 1. <PlatformIdentifier name="before-send" /> / <PlatformIdentifier name="before-breadcrumb" /> | ||||||
| 2. `eventProcessors` | ||||||
| For example, for error events, `hint` holds the original exception so that additional data can be extracted or grouping behavior can be modified. | ||||||
|
|
||||||
| Event and breadcrumb `hints` are objects containing various information used to put together an event or a breadcrumb. Typically `hints` hold the original exception so that additional data can be extracted or grouping can be affected. | ||||||
| In the snippet below, the event is conditionally dropped based on data in the hint: | ||||||
|
|
||||||
| For events, hints contain properties such as `event_id`, `originalException`, `syntheticException` (used internally to generate cleaner stack trace), and any other arbitrary `data` that you attach. | ||||||
|
|
||||||
| For breadcrumbs, the use of `hints` is implementation dependent. For XHR requests, the hint contains the xhr object itself; for user interactions the hint contains the DOM element and event name and so forth. | ||||||
| <PlatformContent includePath="configuration/before-send-hint" /> | ||||||
|
|
||||||
| In this example, the fingerprint is forced to a common value if an exception of a certain type has been caught: | ||||||
| In this snippet, the fingerprint is forced to a common value if an exception of a certain type has been caught: | ||||||
|
|
||||||
| <PlatformContent includePath="configuration/before-send-fingerprint" /> | ||||||
|
|
||||||
| #### Hints for Events | ||||||
|
|
||||||
| `originalException` | ||||||
|
|
||||||
| : The original exception that caused the Sentry SDK to create the event. This is useful for changing how the Sentry SDK groups events or to extract additional information. | ||||||
|
|
||||||
| `syntheticException` | ||||||
|
|
||||||
| : When a string or a non-error object is raised, Sentry creates a synthetic exception so you can get a basic stack trace. This exception is stored here for further data extraction. | ||||||
|
|
||||||
| #### Hints for Breadcrumbs | ||||||
|
|
||||||
| <PlatformContent includePath="configuration/breadcrumb-hints" /> | ||||||
| To see the properties available in the `hint` object, see <PlatformLink to="/configuration/filtering/hint-contents">Hints</PlatformLink>. | ||||||
|
|
||||||
| </PlatformSection> | ||||||
|
|
||||||
| <PlatformSection supported={["android", "javascript", "java", "python"]} > | ||||||
|
|
||||||
| ### Decluttering Sentry | ||||||
| ### Filtering by Script URL, Error Message, or Logger | ||||||
|
|
||||||
| Depending on the SDK, you may be able to filter events automatically based on certain criteria. | ||||||
|
|
||||||
| <PlatformContent includePath="configuration/decluttering" /> | ||||||
|
|
||||||
|
|
||||||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Don't need this H1 as this is already taken care of by the page title