# `PromEx.Plugins.Oban`
[🔗](https://github.com/akoutmos/prom_ex/blob/master/lib/prom_ex/plugins/oban.ex#L2)

This plugin captures metrics emitted by Oban. Specifically, it captures metrics from job events, producer events,
and also from internal polling jobs to monitor queue sizes

This plugin supports the following options:
- `oban_supervisors`: This is an OPTIONAL option and it allows you to specify what Oban instances should have their events
  tracked. By default the only Oban instance that will have its events tracked is the default `Oban` instance. As a result, by
  default this option has a value of `[Oban]`. If you would like to track other named Oban instances, or perhaps your default
  and only Oban instance has a different name, you can pass in your own list of Oban instances (e.g. `[Oban, Oban.PrivateJobs]`).

- `metric_prefix`: This option is OPTIONAL and is used to override the default metric prefix of
  `[otp_app, :prom_ex, :oban]`. If this changes you will also want to set `oban_metric_prefix`
  in your `dashboard_assigns` to the snakecase version of your prefix, the default
  `oban_metric_prefix` is `{otp_app}_prom_ex_oban`.

- `poll_rate`: This option is OPTIONAL and is the rate at which poll metrics are refreshed (default is 5 seconds).

- `duration_unit`: This is an OPTIONAL option and is a `Telemetry.Metrics.time_unit()`. It can be one of:
  `:second | :millisecond | :microsecond | :nanosecond`. It is `:millisecond` by default.

This plugin exposes the following metric groups:
- `:oban_init_event_metrics`
- `:oban_job_event_metrics`
- `:oban_producer_event_metrics`
- `:oban_circuit_event_metrics`
- `:oban_queue_poll_metrics`

To use plugin in your application, add the following to your PromEx module:
```
defmodule WebApp.PromEx do
  use PromEx, otp_app: :web_app

  @impl true
  def plugins do
    [
      ...
      {PromEx.Plugins.Oban, oban_supervisors: [Oban, Oban.AnotherSupervisor], poll_rate: 10_000}
    ]
  end

  @impl true
  def dashboards do
    [
      ...
      {:prom_ex, "oban.json"}
    ]
  end
end
```

# `oban_circuit_breaker_event_metrics`

---

*Consult [api-reference.md](api-reference.md) for complete listing*
