# Context | Sentry for Zap

Custom contexts allow you to attach arbitrary data to an event. Often, this context is shared among any issue captured in its lifecycle. You cannot search these, but they are viewable on the issue page:

If you need to be able to search on custom data, [use tags](https://docs.sentry.io/platforms/go/guides/zap/enriching-events/tags.md) instead.

## [Structured Context](https://docs.sentry.io/platforms/go/guides/zap/enriching-events/context.md#structured-context)

The best way to attach custom data is with a structured context. A context must always be an object and its values can be arbitrary.

Then, use `SetContext` and give the context a unique name:

```go
sentry.ConfigureScope(func(scope *sentry.Scope) {
	scope.SetContext("character", map[string]interface{}{
		"name":        "Mighty Fighter",
		"age":         19,
		"attack_type": "melee",
	})
})
```

There are no restrictions on context name. In the context object, all keys are allowed except for `type`, which is used internally.

Learn more about conventions for common contexts in the [contexts interface developer documentation](https://develop.sentry.dev/sdk/foundations/transport/event-payloads/contexts/).

## [Size Limitations](https://docs.sentry.io/platforms/go/guides/zap/enriching-events/context.md#size-limitations)

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.

The Sentry SDK will try its best to accommodate the data you send and trim large context payloads. The SDK can truncate parts of the event; for more details, see the [developer documentation on SDK data handling](https://develop.sentry.dev/sdk/expected-features/data-handling/).

## [Additional Data](https://docs.sentry.io/platforms/go/guides/zap/enriching-events/context.md#additional-data)

**Additional Data is deprecated** in favor of structured contexts.

Sentry used to support adding unstructured "Additional Data" via `SetExtra`.
