Enriching Events

Add additional data to your events to make them easier to debug.

In addition to the data that the Sentry SDK automatically captures, you can add additional data to events to help you debug them.

There are many ways to enrich events with additional data:

You can add user information to events to help you identify the user that is experiencing an issue. See setUser to learn how to to set the user on Sentry events.

Tags are a way to add additional metadata to events. They can be used to filter events in the Sentry UI. See Tags to learn more about tags, or setTag & setTags to learn how to set tags on Sentry events.

Context is a way to add additional metadata to events. While you cannot filter by contexts in the Sentry UI, context information is displayed in the event details. See setContext to learn how to set context data on Sentry events.

Breadcrumbs are a way to add information about steps that happened prior to an event. See Breadcrumbs to learn how to add breadcrumbs to Sentry events.

Attachments are a way to add additional files to events. See Attachments to learn how to add attachments to Sentry events.

Event processors are a way to mutate events before they are sent to Sentry. See Event Processors to learn how to use event processors.

All APIs described above will attach data to all events for the current request.

If you only want to attach data to certain events, you can use withScope to create a new scope and attach data to that scope only.

All events have a fingerprint. Events with the same fingerprint are grouped together into an issue. If the default grouping for a specific type of event does not work for you, you can customize this by setting a custom fingerprint. See Event Fingerprinting to learn how to set a custom fingerprint.

When an event is captured and sent to Sentry, SDKs will merge that event data with extra information from the current scope. SDKs will typically automatically manage the scopes for you in the framework integrations and you don't need to think about them. However, if you want to better understand how scopes work and how you can leverage them for your use case, you can learn more about scopes.

Learn more about how to isolate requests in order to ensure that set data does not leak between requests.

When sending context, consider payload size limits. Sentry does not recommend sending the entire application state and large data blobs in contexts. If you exceed the maximum payload size, Sentry will respond with HTTP error 413 Payload Too Large and reject the event. When keepalive: true is used, the request may additionally stay pending forever.

The Sentry SDK will try its best to accommodate the data you send and trim large context payloads. Some SDKs can truncate parts of the event; for more details, see the developer documentation on SDK data handling.

Was this helpful?
Help improve this content
Our documentation is open source and available on GitHub. Your contributions are welcome, whether fixing a typo (drat!) or suggesting an update ("yeah, this would be better").