Natus Drew
Natus Drew

Reputation: 1896

Sidekiq Bugsnag Middleware

Is there a way to integrate Bugsnag to rescue all exceptions for Sidekiq and send notifications? I can't find it in the docs.

def call(_worker, _msg, _queue)
Bugsnag.before_notify_callbacks << lambda do |notif|
  notif.add_tab(
    :gem_version,
    metascrape: Metascrape::VERSION
  )
end
yield

rescue ActiveRecord::RecordNotFound => e Bugsnag.notify e ensure Bugsnag.before_notify_callbacks.clear end end

Upvotes: 0

Views: 314

Answers (1)

Mike Perham
Mike Perham

Reputation: 22208

Why do you think you need to do anything? The docs indicate it should just work.

Bugsnag ruby works out of the box with Rails, Sidekiq, Resque, DelayedJob (3+), Mailman, Rake and Rack. It should be easy to add support for other frameworks, either by sending a pull request here or adding a hook to those projects.

https://bugsnag.com/docs/notifiers/ruby

Upvotes: 1

Related Questions