lib/honeybadger/plugins/sidekiq.rb in honeybadger-5.19.2 vs lib/honeybadger/plugins/sidekiq.rb in honeybadger-5.20.0

- old
+ new

@@ -36,14 +36,18 @@ rescue Exception => e status = 'failure' raise ensure context.merge!(duration: duration, status: status) - Honeybadger.event('perform.sidekiq', context) + if Honeybadger.config.load_plugin_insights_events?(:sidekiq) + Honeybadger.event('perform.sidekiq', context) + end - metric_source 'sidekiq' - histogram 'perform', { bins: [30, 60, 120, 300, 1800, 3600, 21_600] }.merge(context.slice(:worker, :queue, :duration)) + if Honeybadger.config.load_plugin_insights_metrics?(:sidekiq) + metric_source 'sidekiq' + gauge 'perform', context.slice(:worker, :queue, :duration) + end end end end class ClientMiddlewareInstrumentation @@ -53,10 +57,12 @@ context = { worker: msg["wrapped"] || msg["class"], queue: queue } - Honeybadger.event('enqueue.sidekiq', context) + if Honeybadger.config.load_plugin_insights_events?(:sidekiq) + Honeybadger.event('enqueue.sidekiq', context) + end yield end end