TaskBunnySentry

Hex.pm

TaskBunny failure backend for Sentry. A port of task_bunny_rollbar.

Installation

def deps do
  [{:task_bunny_sentry, github: "Homepolish/task_bunny_sentry"}]
end

Sample configuration

config :sentry,
  dsn: "YOUR_SENTRY_DSN",
  included_environments: ~w(development),
  environment_name: "development",
  enable_source_code_context: true,
  root_source_code_path: File.cwd!,
  tags: %{env: "development"}

config :task_bunny,
  failure_backend: [TaskBunnySentry]

Check TaskBunny for more configuration options.

Gotcha

Report only when the job is rejected

You might not want to report the failures which are going to be retried. You can do it by writing a thin wrapper in your application.

defmodule TaskBunnySentryWrapper do
  use TaskBunny.FailureBackend
  alias TaskBunny.JobError

  # reject = true means the job won't be retried.
  def report_job_error(error = %JobError{reject: true}),
    do: TaskBunnySentry.report_job_error(error)

  # otherwise ignore.
  def report_job_error(_), do: nil
end

Don’t forget to set the wrapper module as your failure backend.

config :task_bunny, failure_backend: [TaskBunnySentryWrapper]

Copyright (c) 2017, SQUARE ENIX LTD.

TaskBunnySentry code is licensed under the MIT License.