---
title: "Options"
description: "Learn more about how the SDK can be configured via options. These are being passed to the init function and therefore set when the SDK is first initialized."
url: https://docs.sentry.io/platforms/go/guides/echo/configuration/options/
---

# Options | Sentry for Echo

Options are passed to the `Init()` method as an instance of `sentry.ClientOptions`:

```go
sentry.Init(sentry.ClientOptions{
    Dsn: "___PUBLIC_DSN___",
    // Enable printing of SDK debug messages.
    // Useful when getting started or trying to figure something out.
    Debug: true,
    // Adds request headers and IP for users,
    // visit: https://docs.sentry.io/platforms/go/data-management/data-collected/ for more info
    SendDefaultPII: true,
	// Release: "my-project-name@1.0.0",
})
```

## [Core Options](https://docs.sentry.io/platforms/go/guides/echo/configuration/options.md#core-options)

Options that can be read from an environment variable (`SENTRY_DSN`, `SENTRY_ENVIRONMENT`, `SENTRY_RELEASE`) are read automatically.

### [Dsn](https://docs.sentry.io/platforms/go/guides/echo/configuration/options.md#Dsn)

| Type | `string` |
| ---- | -------- |

The DSN tells the SDK where to send the events. If this value is not provided, the SDK will try to read it from the `SENTRY_DSN` environment variable. If that's also missing, no events will be sent.

Learn more about [DSN utilization](https://docs.sentry.io/product/sentry-basics/dsn-explainer.md#dsn-utilization).

### [Debug](https://docs.sentry.io/platforms/go/guides/echo/configuration/options.md#Debug)

| Type    | `bool`  |
| ------- | ------- |
| Default | `false` |

In debug mode, debug information is printed to help you understand what Sentry is doing. It is `false` by default and generally not recommended in production, though it is safe to use.

### [Release](https://docs.sentry.io/platforms/go/guides/echo/configuration/options.md#Release)

| Type | `string` |
| ---- | -------- |

Sets the release. Some Sentry features are built around release info, so reporting releases can help improve the overall experience. See [the releases documentation](https://docs.sentry.io/product/releases.md).

If Release is not set, the SDK will try to derive a default value from environment variables or the Git repository in the working directory.

If you distribute a compiled binary, it is recommended to set the Release value explicitly at build time. As an example, you can use:

```go
go build -ldflags='-X main.release=VALUE'
```

That will set the value of a predeclared variable 'release' in the 'main' package to 'VALUE'. Then, use that variable when initializing the SDK:

```go
sentry.Init(ClientOptions{Release: release})
```

See <https://golang.org/cmd/go/> and <https://golang.org/cmd/link/> for the official documentation of -ldflags and -X, respectively.

### [Dist](https://docs.sentry.io/platforms/go/guides/echo/configuration/options.md#Dist)

| Type | `string` |
| ---- | -------- |

Sets the distribution of the application. Distributions are used to disambiguate build or deployment variants of the same release of an application. For example, the dist can be the build number of an Xcode build or the version code of an Android build. The dist has a max length of 64 characters.

### [Environment](https://docs.sentry.io/platforms/go/guides/echo/configuration/options.md#Environment)

| Type | `string` |
| ---- | -------- |

Sets the environment. This string is freeform and not set by default. A release can be associated with more than one environment to separate them in the UI (think `staging` vs `prod` or similar).

By default, the SDK will try to read this value from the `SENTRY_ENVIRONMENT` environment variable.

Environments tell you where an error occurred, whether that's in your production system, your staging server, or elsewhere. Sentry automatically creates an environment when it receives an event with the environment parameter set.

### [SampleRate](https://docs.sentry.io/platforms/go/guides/echo/configuration/options.md#SampleRate)

| Type    | `float64` |
| ------- | --------- |
| Default | `1.0`     |

Configures the sample rate for error events, in the range of `0.0` to `1.0`. The default is `1.0`, which means that 100% of error events will be sent. If set to `0.1`, only 10% of error events will be sent. Events are picked randomly.

As a historical special case, the sample rate `0.0` is treated as if it was `1.0`. To drop all events, set the DSN to an empty string.

### [MaxBreadcrumbs](https://docs.sentry.io/platforms/go/guides/echo/configuration/options.md#MaxBreadcrumbs)

| Type    | `int` |
| ------- | ----- |
| Default | `100` |

This variable controls the total amount of breadcrumbs that should be captured. However, you should be aware that Sentry has a [maximum payload size](https://develop.sentry.dev/sdk/envelopes/#size-limits) and any events exceeding that payload size will be dropped.

If MaxBreadcrumbs is given a negative value, breadcrumbs are ignored.

### [AttachStacktrace](https://docs.sentry.io/platforms/go/guides/echo/configuration/options.md#AttachStacktrace)

| Type    | `bool`  |
| ------- | ------- |
| Default | `false` |

When enabled, stack traces are automatically attached to all messages logged. Stack traces are always attached to errors; however, when this option is set, stack traces are also sent with messages. This option, for instance, means that stack traces appear next to all log messages.

This option is turned off by default.

Grouping in Sentry is different for events with stack traces and without. As a result, you will get new groups as you enable or disable this flag for certain events.

### [SendDefaultPII](https://docs.sentry.io/platforms/go/guides/echo/configuration/options.md#SendDefaultPII)

| Type    | `bool`  |
| ------- | ------- |
| Default | `false` |

If this flag is enabled, certain personally identifiable information (PII) is added by active integrations. By default, no such data is sent.

If you enable this option, be sure to manually remove what you don't want to send using our features for managing [*Sensitive Data*](https://docs.sentry.io/platforms/go/guides/echo/data-management/sensitive-data.md).

### [ServerName](https://docs.sentry.io/platforms/go/guides/echo/configuration/options.md#ServerName)

| Type | `string` |
| ---- | -------- |

Supplies a server name. When provided, the name of the server is sent along and persisted in the event. For many integrations, the server name actually corresponds to the device hostname, even in situations where the machine is not actually a server.

### [Tags](https://docs.sentry.io/platforms/go/guides/echo/configuration/options.md#Tags)

| Type | `map[string]string` |
| ---- | ------------------- |

Default event tags applied to all events. These are overridden by tags set on a scope.

### [IgnoreErrors](https://docs.sentry.io/platforms/go/guides/echo/configuration/options.md#IgnoreErrors)

| Type | `[]string` |
| ---- | ---------- |

A list of regular expression strings used to match an event’s message, and, when applicable, the type or value of a caught error. If a match is found, the entire event is dropped.

By default, no errors are ignored.

### [MaxErrorDepth](https://docs.sentry.io/platforms/go/guides/echo/configuration/options.md#MaxErrorDepth)

| Type    | `int` |
| ------- | ----- |
| Default | `100` |

This is the maximum number of errors reported in a chain of errors. This protects the SDK from an arbitrarily long chain of wrapped errors.

In practice, reporting very long chains usually provides little value when debugging production issues, as the Sentry UI isn’t optimized for them. The top-level error and its stack trace usually contain the most relevant information.

## [Logging Options](https://docs.sentry.io/platforms/go/guides/echo/configuration/options.md#logging-options)

### [EnableLogs](https://docs.sentry.io/platforms/go/guides/echo/configuration/options.md#EnableLogs)

| Type    | `bool`  |
| ------- | ------- |
| Default | `false` |

Set this option to `true` to enable log capturing in Sentry. The SDK will only capture and send log messages to Sentry if this option is enabled.

## [Metrics Options](https://docs.sentry.io/platforms/go/guides/echo/configuration/options.md#metrics-options)

### [DisableMetrics](https://docs.sentry.io/platforms/go/guides/echo/configuration/options.md#DisableMetrics)

| Type    | `bool`  |
| ------- | ------- |
| Default | `false` |

When set to `true`, the SDK does not emit metrics. By default, metrics are enabled.

## [Client Reports Options](https://docs.sentry.io/platforms/go/guides/echo/configuration/options.md#client-reports-options)

### [DisableClientReports](https://docs.sentry.io/platforms/go/guides/echo/configuration/options.md#DisableClientReports)

| Type    | `bool`  |
| ------- | ------- |
| Default | `false` |

When set to `true`, the SDK does not send client reports. Client reports track the number of discarded events and their reasons, helping you monitor SDK health. By default, client reports are enabled.

## [Tracing Options](https://docs.sentry.io/platforms/go/guides/echo/configuration/options.md#tracing-options)

### [EnableTracing](https://docs.sentry.io/platforms/go/guides/echo/configuration/options.md#EnableTracing)

| Type    | `bool`  |
| ------- | ------- |
| Default | `false` |

Enables performance tracing. When enabled, the SDK will create transactions and spans to measure performance.

### [TracesSampleRate](https://docs.sentry.io/platforms/go/guides/echo/configuration/options.md#TracesSampleRate)

| Type    | `float64` |
| ------- | --------- |
| Default | `0.0`     |

A number between `0.0` and `1.0`, controlling the percentage chance a given transaction will be sent to Sentry (`0.0` represents 0% while `1.0` represents 100%.) Applies equally to all transactions created in the app. Either this or `TracesSampler` must be defined to enable tracing.

### [TracesSampler](https://docs.sentry.io/platforms/go/guides/echo/configuration/options.md#TracesSampler)

| Type | `TracesSampler` |
| ---- | --------------- |

Used to customize the sampling of traces, overrides `TracesSampleRate`. This is a function responsible for determining the percentage chance a given transaction will be sent to Sentry. It will automatically be passed information about the transaction and the context in which it's being created, and must return a number between `0` (0% chance of being sent) and `1` (100% chance of being sent). Can also be used for filtering transactions, by returning 0 for those that are unwanted. Either this or `TracesSampleRate` must be defined to enable tracing.

### [MaxSpans](https://docs.sentry.io/platforms/go/guides/echo/configuration/options.md#MaxSpans)

| Type    | `int`  |
| ------- | ------ |
| Default | `1000` |

Maximum number of spans that can be attached to a transaction.

See <https://develop.sentry.dev/sdk/envelopes/#size-limits> for size limits applied during event ingestion. Events that exceed these limits might get dropped.

### [IgnoreTransactions](https://docs.sentry.io/platforms/go/guides/echo/configuration/options.md#IgnoreTransactions)

| Type | `[]string` |
| ---- | ---------- |

A list of regexp strings that will be used to match against a transaction's name. If a match is found, then the transaction will be dropped.

By default, no transactions are ignored.

### [TracePropagationTargets](https://docs.sentry.io/platforms/go/guides/echo/configuration/options.md#TracePropagationTargets)

| Type | `[]string` |
| ---- | ---------- |

Controls which URLs will have trace propagation enabled. Does not support regex patterns.

### [PropagateTraceparent](https://docs.sentry.io/platforms/go/guides/echo/configuration/options.md#PropagateTraceparent)

| Type    | `bool`  |
| ------- | ------- |
| Default | `false` |

When set to `true`, the W3C Trace Context HTTP `traceparent` header is propagated on outgoing HTTP requests.

### [StrictTraceContinuation](https://docs.sentry.io/platforms/go/guides/echo/configuration/options.md#StrictTraceContinuation)

| Type    | `bool`  |
| ------- | ------- |
| Default | `false` |

When set to `true`, the SDK requires matching organization IDs in the incoming baggage header for continuing a trace. This is useful for preventing trace continuation from 3rd-party services that happen to be instrumented by Sentry but belong to a different organization.

### [OrgID](https://docs.sentry.io/platforms/go/guides/echo/configuration/options.md#OrgID)

| Type | `uint64` |
| ---- | -------- |

Configures the organization ID used for trace propagation and features like `StrictTraceContinuation`. In most cases, the organization ID is already parsed from the DSN. This option should be used when non-standard Sentry DSNs are used, such as self-hosted or when using a local Relay.

### [TraceIgnoreStatusCodes](https://docs.sentry.io/platforms/go/guides/echo/configuration/options.md#TraceIgnoreStatusCodes)

| Type | `[][]int` |
| ---- | --------- |

A list of HTTP status codes that should not be traced. Each element can be either:

* A single-element slice `[code]` for a specific status code (for example, `[][]int{{404}}` to ignore 404 statuses)
* A two-element slice `[min, max]` for a range of status codes, inclusive (for example, `[][]int{{400, 405}}` for 400–405 statuses)

When an HTTP request results in a status code that matches any of these codes or ranges, the transaction will not be sent to Sentry.

By default, 404 status codes are ignored. To allow all status codes, set this option to an empty slice (not `nil`).

## [Hooks](https://docs.sentry.io/platforms/go/guides/echo/configuration/options.md#hooks)

These options can be used to hook the SDK in various ways to customize the reporting of events.

### [BeforeSend](https://docs.sentry.io/platforms/go/guides/echo/configuration/options.md#BeforeSend)

| Type | `func(event *Event, hint *EventHint) *Event` |
| ---- | -------------------------------------------- |

This function is called with an event object, and can return a modified event object, or `nil` to skip reporting the event. This can be used, for instance, for manual PII stripping before sending.

By the time `BeforeSend` is executed, all scope data has already been applied to the event. Further modification of the scope won't have any effect.

### [BeforeSendTransaction](https://docs.sentry.io/platforms/go/guides/echo/configuration/options.md#BeforeSendTransaction)

| Type | `func(event *Event, hint *EventHint) *Event` |
| ---- | -------------------------------------------- |

This function is called with a transaction object, and can return a modified transaction object, or `nil` to skip reporting the transaction. One way this might be used is for manual PII stripping before sending.

### [BeforeSendLog](https://docs.sentry.io/platforms/go/guides/echo/configuration/options.md#BeforeSendLog)

| Type | `func(event *Log) *Log` |
| ---- | ----------------------- |

This function is called before log events are sent to Sentry. You can use it to mutate the log event or return `nil` to discard it.

### [BeforeSendMetric](https://docs.sentry.io/platforms/go/guides/echo/configuration/options.md#BeforeSendMetric)

| Type | `func(metric *Metric) *Metric` |
| ---- | ------------------------------ |

This function is called before metric events are sent to Sentry. You can use it to mutate the metric or return `nil` to discard it.

### [BeforeBreadcrumb](https://docs.sentry.io/platforms/go/guides/echo/configuration/options.md#BeforeBreadcrumb)

| Type | `func(breadcrumb *Breadcrumb, hint *BreadcrumbHint) *Breadcrumb` |
| ---- | ---------------------------------------------------------------- |

This function is called with a breadcrumb object before the breadcrumb is added to the scope. When `nil` is returned from the function, the breadcrumb is dropped. To pass the breadcrumb through, return the first argument, which contains the breadcrumb object. The callback typically gets a second argument (called a "hint") that provides the original object used to create the breadcrumb. You can use this to further customize the breadcrumb’s content or appearance.

## [Integration Configuration](https://docs.sentry.io/platforms/go/guides/echo/configuration/options.md#integration-configuration)

### [Integrations](https://docs.sentry.io/platforms/go/guides/echo/configuration/options.md#Integrations)

| Type | `func([]Integration) []Integration` |
| ---- | ----------------------------------- |

Integrations to be installed on the current Client, receives default integrations. This function can be used to add additional integrations or remove default integrations. For more information, please see our documentation for a specific integration.

See the [Removing Default Integrations](https://docs.sentry.io/platforms/go/guides/echo/configuration/options.md#removing-default-integrations) section below for an example.

### [DebugWriter](https://docs.sentry.io/platforms/go/guides/echo/configuration/options.md#DebugWriter)

| Type | `io.Writer` |
| ---- | ----------- |

`io.Writer` implementation that should be used with the Debug mode. This allows you to redirect debug output to a custom writer instead of stdout.

## [Transport Options](https://docs.sentry.io/platforms/go/guides/echo/configuration/options.md#transport-options)

Transports are used to send events to Sentry. Transports can be customized to some degree to better support highly specific deployments.

### [Transport](https://docs.sentry.io/platforms/go/guides/echo/configuration/options.md#Transport)

| Type | `Transport` |
| ---- | ----------- |

The transport to use. Defaults to `HTTPTransport`. Switches out the transport used to send events. How this works depends on the SDK. It can, for instance, be used to capture events for unit-testing or to send it through some more complex setup that requires proxy authentication.

### [HTTPClient](https://docs.sentry.io/platforms/go/guides/echo/configuration/options.md#HTTPClient)

| Type | `*http.Client` |
| ---- | -------------- |

An optional pointer to `http.Client` that will be used with a default HTTPTransport. Using your own client will make HTTPTransport, HTTPProxy, HTTPSProxy and CaCerts options ignored.

### [HTTPTransport](https://docs.sentry.io/platforms/go/guides/echo/configuration/options.md#HTTPTransport)

| Type | `http.RoundTripper` |
| ---- | ------------------- |

An optional pointer to http.Transport that will be used with a default HTTPTransport. Using your own transport will make HTTPProxy, HTTPSProxy and CaCerts options ignored.

### [HTTPProxy](https://docs.sentry.io/platforms/go/guides/echo/configuration/options.md#HTTPProxy)

| Type | `string` |
| ---- | -------- |

When set, a proxy can be configured that should be used for outbound requests. This is also used for HTTPS requests unless a separate `HTTPSProxy` is configured.

This will default to the HTTP\_PROXY environment variable.

### [HTTPSProxy](https://docs.sentry.io/platforms/go/guides/echo/configuration/options.md#HTTPSProxy)

| Type | `string` |
| ---- | -------- |

Configures a separate proxy for outgoing HTTPS requests. If this option is not provided but `HTTPProxy` is, then `HTTPProxy` is used for HTTPS requests too.

This will default to the HTTPS\_PROXY environment variable. HTTPS\_PROXY takes precedence over HTTP\_PROXY for https requests.

### [CaCerts](https://docs.sentry.io/platforms/go/guides/echo/configuration/options.md#CaCerts)

| Type | `*x509.CertPool` |
| ---- | ---------------- |

An optional set of SSL certificates to use. See the [Providing SSL Certificates](https://docs.sentry.io/platforms/go/guides/echo/configuration/options.md#providing-ssl-certificates) section below for an example.

### [DisableTelemetryBuffer](https://docs.sentry.io/platforms/go/guides/echo/configuration/options.md#DisableTelemetryBuffer)

| Type    | `bool`  |
| ------- | ------- |
| Default | `false` |

When set to `true`, disables the telemetry buffer layer for prioritizing events and uses the legacy transport layer instead.

### [Providing SSL Certificates](https://docs.sentry.io/platforms/go/guides/echo/configuration/options.md#providing-ssl-certificates)

By default, TLS uses the host's root CA set. If you don't have `ca-certificates` (which should be your go-to way of fixing the issue of the missing certificates) and want to use `gocertifi` instead, you can provide pre-loaded cert files as one of the options to the `sentry.Init` call:

```go
sentryClientOptions := sentry.ClientOptions{
	Dsn: "___PUBLIC_DSN___",
}

rootCAs, err := gocertifi.CACerts()
if err != nil {
	log.Println("Could not load CA Certificates: %v\n", err)
} else {
	sentryClientOptions.CaCerts = rootCAs
}

sentry.Init(sentryClientOptions)
```

### [Removing Default Integrations](https://docs.sentry.io/platforms/go/guides/echo/configuration/options.md#removing-default-integrations)

`sentry-go` SDK has few built-in integrations that enhance events with additional information, or manage them in one way or another.

If you want to read more about them, see the [source code](https://github.com/getsentry/sentry-go/blob/master/integrations.go) directly.

However, there are some cases where you may want to disable some of them. To do this, you can use the `Integrations` configuration option and filter unwanted integrations. For example:

```go
sentry.Init(sentry.ClientOptions{
	// ...
	Integrations: func(integrations []sentry.Integration) []sentry.Integration {
		var filteredIntegrations []sentry.Integration
		for _, integration := range integrations {
			if integration.Name() == "ContextifyFrames" {
				continue
			}
			filteredIntegrations = append(filteredIntegrations, integration)
		}
		return filteredIntegrations
	},
})
```
