-
Notifications
You must be signed in to change notification settings - Fork 145
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: track exceptions in :solid_queue (#526)
And any other ActiveJob adapters that come along :) Fixes #518
- Loading branch information
Showing
2 changed files
with
11 additions
and
11 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,29 +1,30 @@ | ||
module Honeybadger | ||
module Plugins | ||
module ActiveJob | ||
|
||
# Ignore inline and test adapters, as well as the adapters that we support with their own plugins | ||
EXCLUDED_ADAPTERS = %i[inline test delayed_job faktory karafka resque shoryuken sidekiq sucker_punch].freeze | ||
|
||
Plugin.register { | ||
requirement { defined?(::Rails.application) && ::Rails.application } | ||
requirement { | ||
::Rails.application.config.respond_to?(:active_job) && | ||
::Rails.application.config.active_job[:queue_adapter] == :async | ||
!EXCLUDED_ADAPTERS.include?(::Rails.application.config.active_job[:queue_adapter]) | ||
} | ||
|
||
execution { | ||
::ActiveJob::Base.class_eval do |base| | ||
::ActiveJob::Base.class_eval do |base| | ||
base.set_callback :perform, :around do |param, block| | ||
Honeybadger.clear! | ||
begin | ||
block.call | ||
rescue => error | ||
Honeybadger.notify(error, parameters: { job_arguments: self.arguments }) | ||
Honeybadger.notify(error, parameters: {job_id: job_id, arguments: arguments}) | ||
raise error | ||
end | ||
end | ||
end | ||
end | ||
} | ||
} | ||
end | ||
end | ||
|
||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters