Oban

AppSignal for ElixirThis feature requires version 2.5.0 or higher.
ObanThis feature requires version 2.0 or higher.

The AppSignal for Elixir package instruments jobs performed by Oban workers, and collects metrics about your jobs' performance.

Oban is a job queueing and processing system for Elixir, based on PostgreSQL and Ecto. You can use Oban to schedule jobs to be ran in the background.

Automatic Instrumentation

Oban support is automatically instrumented, requiring no configuration.

To disable the Oban instrumentation, set the instrument_oban config option to false.

The instrument_oban config option was added in version 2.5.1 of the AppSignal for Elixir integration.

Error Reporting

By default, the Oban instrumentation will create an error sample whenever one of your workers fails to process a job, either by returning an {:error, _} tuple or by throwing an exception.

If you only wish to send errors to AppSignal when the failure causes the job to be discarded, that is, once it's reached its maximum retry attempts, set the report_oban_errors config option to "discard". Set it to "none" to never send Oban job errors to AppSignal.

The report_oban_errors config option was added in version 2.5.1 of the AppSignal for Elixir integration.

If using Oban version 2.3.1 or below, the information about the state of the job is not available, and the "discard" option will behave like "all".

Performance and Error Samples

AppSignal will create performance samples out of jobs executed by your Oban workers:

Performance sample from an Oban job execution

It will also notify errors that cause your workers to fail while processing a job:

Error sample from an Oban job execution

Within the performance and error samples, the tags will contain information about the job:

  • Job ID, queue, worker and priority
  • Number of previous attempts
  • Job state and result after execution

Any tags or metadata values added to the job will also be present as tags in the sample, allowing you to filter the samples for a specific tag.

You will also be able to see when an Oban job is inserted in the event timeline of your application's performance samples:

Event timeline showing an Oban job insertion

Some features are only available in certain Oban versions:

  • 2.1.0+: Tags
  • 2.3.1+: Metadata values and job priority
  • 2.4.0+: Job state after execution
  • 2.5.0+: Job result after execution
  • 2.11.0+: Job insertion event

To make use of all the features described above, upgrade to the latest Oban version.

Metrics

In addition to the performance and error samples, AppSignal for Elixir will collect metrics about the performance of your Oban jobs:

  • oban_job_duration: the duration of the jobs processed, tagged by the job's worker, queue and status.

  • oban_job_queue_time: the time spent by jobs waiting in the queue, tagged by queue.

  • oban_job_count: the amount of jobs processed, tagged by the job's worker, queue and status.

Using this metrics, AppSignal will automatically create the Oban automated dashboard, which provides key insights into your Oban system's performance:

Automated dashboard showing key Oban metrics