Skip to content

Commit

Permalink
docs(elixir): Improve Oban integration docs (#10908)
Browse files Browse the repository at this point in the history
  • Loading branch information
whatyouhide authored Aug 6, 2024
1 parent 1422f6c commit ad06f74
Showing 1 changed file with 16 additions and 1 deletion.
17 changes: 16 additions & 1 deletion docs/platforms/elixir/integrations/oban/index.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@ This integration is built into the Sentry SDK starting with *v10.2.0*. It suppor
You can configure the Oban integration in your Sentry configuration, under the `:integrations` key:

```elixir {filename:config/config.exs}

config :sentry,
# ...,
integrations: [
Expand All @@ -33,3 +32,19 @@ config :sentry,
```

This configuration will report failed Oban jobs to Sentry. It will also report started, completed, and failed jobs, as well as their duration. It will use the worker name as the `monitor_slug` of the reported cron.

<Alert level="info" title="Perform Errors">
Oban wraps *unhandled* crashes, exits, and throws in jobs inside [`Oban.CrashError`](https://hexdocs.pm/oban/2.18.0/Oban.CrashError.html) exceptions. However, if jobs return errors manually (such as by returning `{:error, reason}` tuples) then Oban will wrap those inside [`Oban.PerformError`](https://hexdocs.pm/oban/2.18.0/Oban.PerformError.html) exceptions. If you only want to report crashes to Sentry, you can either configure an event filter that doesn't report `Oban.PerformError` events, or that inspects its `:reason` field to determine whether to report them. For example:

```elixir
def before_send(event) do
case event.original_exception do
%Oban.PerformError{reason: {:error, reason}} -> event
%Oban.PerformError{} -> nil
_other -> event
end
end
```

See <Link to="/platforms/elixir/configuration/filtering">the documentation for event callbacks</Link>.
</Alert>

0 comments on commit ad06f74

Please sign in to comment.