Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -13,5 +13,3 @@ Sentry.init({
},
});
```

For information about which hints are available see <PlatformLink to="/configuration/filtering/#using-hints">hints in JavaScript</PlatformLink>.
Original file line number Diff line number Diff line change
Expand Up @@ -12,5 +12,3 @@ sentry_sdk.init(
before_breadcrumb=before_breadcrumb,
)
```

For information about which hints are available see <PlatformLink to="/configuration/filtering/#using-hints">hints in Python</PlatformLink>.
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.
2 changes: 0 additions & 2 deletions src/platform-includes/configuration/before-send-hint/go.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -10,5 +10,3 @@ sentry.Init(sentry.ClientOptions{
},
})
```

For information about which hints are available see [`EventHint` implementation](https://github.com/getsentry/sentry-go/blob/master/interfaces.go).
Original file line number Diff line number Diff line change
Expand Up @@ -3,17 +3,13 @@ Sentry.init({
// ...

beforeSend(event, hint) {
const error = hint.originalException;
if (
error &&
error.message &&
error.message.match(/database unavailable/i)
hint.originalException instanceof DOMException &&
hint.originalException.name === "NotSupportedError"
) {
event.fingerprint = ["database-unavailable"];
return null;
}
return event;
},
});
```

For information about which hints are available see <PlatformLink to="/configuration/filtering/#using-hints">hints in JavaScript</PlatformLink>.
Original file line number Diff line number Diff line change
Expand Up @@ -14,5 +14,3 @@ sentry_sdk.init(
before_send=before_send,
)
```

For information about which hints are available see <PlatformLink to="/configuration/filtering/#using-hints">hints in Python</PlatformLink>.
2 changes: 0 additions & 2 deletions src/platform-includes/configuration/before-send-hint/ruby.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -10,5 +10,3 @@ Sentry.init do |config|
end
end
```

For information about which hints are available see <PlatformLink to="/configuration/filtering/#using-hints">hints in Ruby</PlatformLink>.
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.
29 changes: 29 additions & 0 deletions src/platforms/common/configuration/filtering/hint-contents.mdx
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
Copy link
Contributor

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

Suggested change
# 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
Expand Up @@ -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,
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
- by using event processors,
- by using event processors

- by configuring, enabling, or disabling integrations.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
- by configuring, enabling, or disabling integrations.
- by configuring, enabling, or disabling integrations


### 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 its 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 events 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
Copy link
Contributor

Choose a reason for hiding this comment

The 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" />

Expand Down
2 changes: 1 addition & 1 deletion src/platforms/common/enriching-events/breadcrumbs.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ This hook is passed an already assembled breadcrumb and, in some SDKs, an option

<PlatformSection notSupported={["apple", "dotnet", "unity"]}>

For information about what can be done with the hint, see <PlatformLink to="/configuration/filtering/#using-hints">Filtering Events</PlatformLink>.
For information about what can be done with the hint, see <PlatformLink to="/configuration/filtering/#hints">Filtering Events</PlatformLink>.

</PlatformSection>

Expand Down
2 changes: 1 addition & 1 deletion src/platforms/common/enriching-events/event-processors.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ notSupported:
---

With `eventProcessors` you can hook into the process of enriching the event with additional data. You can add your own `eventProcessor` on the current scope. The difference between `beforeSend` and `eventProcessors` is that `eventProcessors` run on the scope level whereas `beforeSend` runs globally, no matter which scope you're in.
Also, `eventProcessors` optionally receive the hint (see: <PlatformLink to="/configuration/filtering/#using-hints">hints</PlatformLink>).
Also, `eventProcessors` optionally receive the hint (see: <PlatformLink to="/configuration/filtering/#hints">hints</PlatformLink>).

```javascript
// This will be set globally for every succeeding event send
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ Sentry provides a proof-of-concept integration with [rrweb](https://www.rrweb.io

<Note>

For information about which hints are available see <PlatformLink to="/configuration/filtering/#using-hints">hints in JavaScript</PlatformLink>
For information about which hints are available see <PlatformLink to="/configuration/filtering/#hints">hints in JavaScript</PlatformLink>

Replays utilize <PlatformLink to="/enriching-events/attachments/">Attachments</PlatformLink>.

Expand Down