def call(worker, msg, queue, &block)
if msg["wrapped"]
context = {
jid: msg["jid"],
worker: msg["wrapped"],
queue: queue
}
else
context = {
jid: msg["jid"],
worker: msg["class"],
queue: queue
}
end
begin
duration = Honeybadger.instrumentation.monotonic_timer { block.call }[0]
status = 'success'
rescue Exception => e
status = 'failure'
raise
ensure
context.merge!(duration: duration, status: status)
if Honeybadger.config.load_plugin_insights_events?(:sidekiq)
Honeybadger.event('perform.sidekiq', context)
end
if Honeybadger.config.load_plugin_insights_metrics?(:sidekiq)
metric_source 'sidekiq'
gauge 'perform', context.slice(:worker, :queue, :duration)
end
end
end