Add Context

Custom contexts allow you to attach arbitrary data to an event. You cannot search these, but they are viewable on the issue page:

Custom contexts as viewed on the Additional Data section of an event

To configure additional context:

using Sentry;

SentrySdk.ConfigureScope(scope =>
    scope.SetExtra("", "Mighty Fighter");

Note that the context's outer value has to be a dictionary/map/object, while the inner values can be arbitrary.

When sending context, be aware of maximum payload size, especially if you want to send the whole application state as extra data. Sentry does not recommend this approach since application state can be very large and easily exceed the 200kB maximum that Sentry has on individual event payloads. When this happens, you’ll receive an HTTP Error 413 Payload Too Large message as the server response or (when you set keepalive: true as a fetch parameter), the request will stay pending forever (for example, in Google Chrome).

Sentry will try its best to accommodate the data you send, but Sentry will trim large context payloads or truncate the payloads entirely.

For more details, see the developer documentation on SDK data handling.

Extra Data, Additional Data

If you come across any usages of "extra" (SetExtra in code) or "Additional Data" (in the UI), just mentally substitute it for context. Extra is deprecated in favor of context within most SDKs.

You can edit this page on GitHub.