Class: RorVsWild::Plugin::Sidekiq

Inherits:
Object
  • Object
show all
Defined in:
lib/rorvswild/plugin/sidekiq.rb

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.setupObject



4
5
6
7
8
9
10
# File 'lib/rorvswild/plugin/sidekiq.rb', line 4

def self.setup
  if defined?(::Sidekiq)
    ::Sidekiq.configure_server do |config|
      config.server_middleware { |chain| chain.add(Sidekiq) }
    end
  end
end

Instance Method Details

#call(worker, item, queue, &block) ⇒ Object



12
13
14
15
16
# File 'lib/rorvswild/plugin/sidekiq.rb', line 12

def call(worker, item, queue, &block)
  # Wrapped contains the real class name of the ActiveJob wrapper
  name = item["wrapped".freeze] || item["class".freeze]
  RorVsWild.agent.measure_job(name, parameters: item["args".freeze], &block)
end