Skip to content

docs(elixir-sdk): refactor config options page #12621

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Feb 7, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
80 changes: 41 additions & 39 deletions docs/platforms/elixir/configuration/options.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -6,110 +6,112 @@ sidebar_order: 1

<PlatformContent includePath="configuration/config-intro" />

## Available Options

<TableOfContents ignoreIds={["available-options"]} />

## Core Options

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

<ConfigKey name="dsn">
<SdkOption name="dsn" type='string' envVar='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.

In runtimes without a process environment (such as the browser) that fallback does not apply.

Learn more about [DSN utilization](/product/sentry-basics/dsn-explainer/#dsn-utilization).

</ConfigKey>
</SdkOption>

<ConfigKey name="release">
<SdkOption name="release" type='string' envVar='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](/product/releases/) or the <SandboxLink scenario="releases">sandbox</SandboxLink>.

By default the SDK will try to read this value from the `SENTRY_RELEASE` environment variable (in the browser SDK, this will be read off of the `window.SENTRY_RELEASE.id` if available).
By default the SDK will try to read this value from the `SENTRY_RELEASE` environment variable.

</ConfigKey>
</SdkOption>

<ConfigKey name="environment">
<SdkOption name="environment" type='string' envVar='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 (except for the browser SDK where this is not applicable).
By default the SDK will try to read this value from the `SENTRY_ENVIRONMENT` environment variable.

</ConfigKey>
</SdkOption>

<ConfigKey name="sample-rate">
<SdkOption name="sample_rate" type='float' defaultValue='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.

</ConfigKey>
</SdkOption>

<ConfigKey name="max-breadcrumbs">
<SdkOption name="max_breadcrumbs" type='integer' defaultValue='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.

</ConfigKey>
</SdkOption>

<ConfigKey name="server-name">
<SdkOption name="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.
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.

</ConfigKey>
</SdkOption>

## Hooks

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

<ConfigKey name="before-send">
<SdkOption name="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 <PlatformIdentifier name="before-send" /> is executed, all scope data has already been applied to the event. Further modification of the scope won't have any effect.
By the time <PlatformIdentifier name="before_send" /> is executed, all scope data has already been applied to the event. Further modification of the scope won't have any effect.

</ConfigKey>
</SdkOption>

<ConfigKey name="after-send-event">
<SdkOption name="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.

</ConfigKey>
</SdkOption>

## Transport Options

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

<ConfigKey name="send-result">
<SdkOption name="send_result" defaultValue=':none'>

Controls whether to report events to Sentry _synchronously_ (if set to `:sync`) or _asynchronously_ (if set to `:none`). Defaults to `:none`.
Controls whether to report events to Sentry _synchronously_ (if set to `:sync`) or _asynchronously_ (if set to `:none`).

</ConfigKey>
</SdkOption>

<ConfigKey name="send-max-attempts">
<SdkOption name="send_max_attempts" type='integer' defaultValue='4'>

The maximum number of attempts to send an event to Sentry. Defaults to `4`.
The maximum number of attempts to send an event to Sentry.

</ConfigKey>
</SdkOption>

<ConfigKey name="client">
<SdkOption name="client" defaultValue='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.

</ConfigKey>
</SdkOption>

<ConfigKey name="hackney-opts">
<SdkOption name="hackney_opts" defaultValue='[pool: :sentry_pool]'>

Options to be passed to Hackney. Only applied if `client` is set to `Sentry.HackneyClient`. Defaults to `[pool: :sentry_pool]`.
Options to be passed to Hackney. Only applied if `client` is set to `Sentry.HackneyClient`.

</ConfigKey>
</SdkOption>

<ConfigKey name="hackney-pool-max-connections">
<SdkOption name="hackney_pool_max_connections" type='integer' defaultValue='50'>

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

</ConfigKey>
</SdkOption>

<ConfigKey name="hackney-pool-timeout">
<SdkOption name="hackney_pool_timeout" type='integer' defaultValue='5000'>

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

</ConfigKey>
</SdkOption>
2 changes: 2 additions & 0 deletions docs/platforms/elixir/index.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@ sdk: sentry.elixir
caseStyle: snake_case
supportLevel: production
showIntegrationsInSearch: true
categories:
- server
---

On this page, we get you up and running with Sentry's SDK.
Expand Down
Loading