We currently set the job params and component/action in our Sidekiq error handler:
|
opts = {parameters: params} |
|
if config[:"sidekiq.use_component"] |
|
opts[:component] = job["wrapped".freeze] || job["class".freeze] |
|
opts[:action] = "perform" if opts[:component] |
|
end |
|
|
|
Honeybadger.notify(ex, **opts) |
If someone rescues/handles an exception in a job and manually reports it to Honeybadger, that info isn't reported with the error:
class HardJob,
include Sidekiq::Job
def perform(name, count)
rescue => error
Honeybadger.notify(error) # Doesn't include job context
end
end
end
We may be able to solve this by using Honeybadger.context to add the job context in our Sidekiq middleware instead:
|
module Sidekiq |
|
class Middleware |
|
def call(_worker, _msg, _queue) |
|
Honeybadger.clear! |
|
yield |
|
end |
|
end |
However, switching to Honeybadger.context would break compatibility since we currently send the job context in the notice's parameters, not context. We'd need a way to add the params like we do for context. The new ExecutionContext store I added to #771 might be useful for that, once it's merged.
References
Front conversations
We currently set the job params and component/action in our Sidekiq error handler:
honeybadger-ruby/lib/honeybadger/plugins/sidekiq.rb
Lines 123 to 129 in d4b0754
If someone rescues/handles an exception in a job and manually reports it to Honeybadger, that info isn't reported with the error:
We may be able to solve this by using
Honeybadger.contextto add the job context in our Sidekiq middleware instead:honeybadger-ruby/lib/honeybadger/plugins/sidekiq.rb
Lines 7 to 13 in d4b0754
However, switching to
Honeybadger.contextwould break compatibility since we currently send the job context in the notice'sparameters, notcontext. We'd need a way to add the params like we do for context. The newExecutionContextstore I added to #771 might be useful for that, once it's merged.References