Class: Honeybadger::Plugins::Sidekiq::ServerMiddlewareInstrumentation Private
- Inherits:
-
Object
- Object
- Honeybadger::Plugins::Sidekiq::ServerMiddlewareInstrumentation
- Includes:
- InstrumentationHelper
- Defined in:
- lib/honeybadger/plugins/sidekiq.rb
This class is part of a private API. You should avoid using this class if possible, as it may be removed or be changed in the future.
Instance Method Summary collapse
Methods included from InstrumentationHelper
#decrement_counter, #extract_attributes, #extract_callable, #gauge, #histogram, #increment_counter, #metric_agent, #metric_attributes, #metric_instrumentation, #metric_source, #monotonic_timer, #time
Instance Method Details
#call(worker, msg, queue, &block) ⇒ Object
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 |
# File 'lib/honeybadger/plugins/sidekiq.rb', line 18 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 |