---
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/elixir/configuration/options/
---

# Options | Sentry for Elixir

In Elixir, configuration is handled using the standard Elixir configuration ([`Config`](https://hexdocs.pm/elixir/Config.html)).

Add configuration to the `:sentry` application in the your config file.

`config/prod.exs`

```elixir
config :sentry,
  dsn: "___PUBLIC_DSN___"
```

We recommend only enabling Sentry in production, so this configuration should go in `config/prod.exs` in a standard application structure.

## [Available Options](https://docs.sentry.io/platforms/elixir/configuration/options.md#available-options)



## [Core Options](https://docs.sentry.io/platforms/elixir/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/elixir/configuration/options.md#dsn)

| Type         | `string`     |
| ------------ | ------------ |
| ENV Variable | `SENTRY_DSN` |

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 variable also does not exist, the SDK will just not send any events.

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

### [release](https://docs.sentry.io/platforms/elixir/configuration/options.md#release)

| Type         | `string`         |
| ------------ | ---------------- |
| ENV Variable | `SENTRY_RELEASE` |

Sets the release. Some SDKs will try to automatically configure a release out of the box but it's a better idea to manually set it to guarantee that the release is in sync with your deploy integrations or source map uploads. Release names are strings, but some formats are detected by Sentry and might be rendered differently. Learn more about how to send release data so Sentry can tell you about regressions between releases and identify the potential source in [the releases documentation](https://docs.sentry.io/product/releases.md) or the [sandbox](https://sandbox.sentry.io/?scenario=releases\&source=docs).

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

### [environment](https://docs.sentry.io/platforms/elixir/configuration/options.md#environment)

| Type         | `string`             |
| ------------ | -------------------- |
| ENV Variable | `SENTRY_ENVIRONMENT` |

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.

### [sample\_rate](https://docs.sentry.io/platforms/elixir/configuration/options.md#sample_rate)

| Type    | `float` |
| ------- | ------- |
| 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.

### [max\_breadcrumbs](https://docs.sentry.io/platforms/elixir/configuration/options.md#max_breadcrumbs)

| Type    | `integer` |
| ------- | --------- |
| Default | `100`     |

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

### [server\_name](https://docs.sentry.io/platforms/elixir/configuration/options.md#server_name)

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

This option can be used to supply 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.

Most SDKs will attempt to auto-discover this value.

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

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

### [before\_send](https://docs.sentry.io/platforms/elixir/configuration/options.md#before_send)

| Type | `function` |
| ---- | ---------- |

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

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

### [after\_send\_event](https://docs.sentry.io/platforms/elixir/configuration/options.md#after_send_event)

| Type | `function` |
| ---- | ---------- |

This function is called with an event and the result of sending that event. This is useful to log send results, instrument Sentry calls, and so on.

## [Transport Options](https://docs.sentry.io/platforms/elixir/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.

### [send\_result](https://docs.sentry.io/platforms/elixir/configuration/options.md#send_result)

| Default | `:none` |
| ------- | ------- |

Controls whether to report events to Sentry *synchronously* (if set to `:sync`) or *asynchronously* (if set to `:none`).

### [send\_max\_attempts](https://docs.sentry.io/platforms/elixir/configuration/options.md#send_max_attempts)

| Type    | `integer` |
| ------- | --------- |
| Default | `4`       |

The maximum number of attempts to send an event to Sentry.

### [client](https://docs.sentry.io/platforms/elixir/configuration/options.md#client)

| Default | `Sentry.HackneyClient` |
| ------- | ---------------------- |

The HTTP client to use for sending events to Sentry. This must be a module that implements the [`Sentry.HTTPClient`](https://hexdocs.pm/sentry/Sentry.HTTPClient.html) behaviour. Defaults to `Sentry.HackneyClient`, which is based on the [Hackney](https://hexdocs.pm/hackney) HTTP client.

### [hackney\_opts](https://docs.sentry.io/platforms/elixir/configuration/options.md#hackney_opts)

| Default | `[pool: :sentry_pool]` |
| ------- | ---------------------- |

Options to be passed to Hackney. Only applied if `client` is set to `Sentry.HackneyClient`.

### [hackney\_pool\_max\_connections](https://docs.sentry.io/platforms/elixir/configuration/options.md#hackney_pool_max_connections)

| Type    | `integer` |
| ------- | --------- |
| Default | `50`      |

The maximum number of connections to keep in the pool. Only applied if `client` is set to `Sentry.HackneyClient`.

### [hackney\_pool\_timeout](https://docs.sentry.io/platforms/elixir/configuration/options.md#hackney_pool_timeout)

| Type    | `integer` |
| ------- | --------- |
| Default | `5000`    |

The maximum time to wait (in milliseconds) for a connection to become available. Only applied if `client` is set to `Sentry.HackneyClient`.

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

### [traces\_sample\_rate](https://docs.sentry.io/platforms/elixir/configuration/options.md#traces_sample_rate)

| Type    | `float` |
| ------- | ------- |
| Default | `nil`   |

A number between `0.0` and `1.0` that determines the percentage of transactions that will be sent to Sentry. Either this or `traces_sampler` must be defined to enable tracing.

```elixir
config :sentry,
  traces_sample_rate: 0.2  # Sample 20% of transactions
```

### [traces\_sampler](https://docs.sentry.io/platforms/elixir/configuration/options.md#traces_sampler)

| Type | `function` |
| ---- | ---------- |

A function that determines the sample rate for transaction events. This function receives a sampling context map and should return a boolean or a float between `0.0` and `1.0`.

```elixir
config :sentry,
  traces_sampler: fn sampling_context ->
    case sampling_context.transaction_context.op do
      "http.server" -> 0.1  # Sample 10% of HTTP requests
      _ -> 0.05             # Sample 5% of other operations
    end
  end
```

If both `:traces_sampler` and `:traces_sample_rate` are configured, `:traces_sampler` takes precedence.

## [Telemetry Processor Options](https://docs.sentry.io/platforms/elixir/configuration/options.md#telemetry-processor-options)

The Telemetry Processor is a buffered, priority-based event delivery mechanism. It batches events and sends them to Sentry using a weighted scheduler that prioritizes critical events (like errors) over lower-priority ones (like logs). Logs are routed through the Telemetry Processor by default. You can opt in to route other event types through the processor as well. In a future major release, the Telemetry Processor will become the default delivery mechanism for all event types.

### [telemetry\_processor\_categories](https://docs.sentry.io/platforms/elixir/configuration/options.md#telemetry_processor_categories)

| Type    | `list`   |
| ------- | -------- |
| Default | `[:log]` |

A list of event categories to route through the Telemetry Processor. By default, only `:log` events use the processor. You can opt in to route additional event types through it.

Valid categories:

* `:error` — error events (critical priority)
* `:check_in` — cron check-in events (high priority)
* `:transaction` — transaction events (medium priority)
* `:log` — log events (low priority)

```elixir
config :sentry,
  telemetry_processor_categories: [:error, :check_in, :transaction, :log]
```
