Class: Sidekiq::Middleware::Server::HarnessInstrumentation

Inherits:
Object
  • Object
show all
Defined in:
lib/harness/integration/sidekiq.rb

Instance Method Summary collapse

Instance Method Details

#call(worker_class, item, queue) ⇒ Object



5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
# File 'lib/harness/integration/sidekiq.rb', line 5

def call(worker_class, item, queue)
  if instrument? worker_class
    logger.debug "Instrumenting: #{worker_class.inspect}"

    options = {}
    options[:gauge] = "#{worker_class.class.to_s.underscore}.sidekiq"
    options[:counter] = "#{worker_class.class.to_s.pluralize.underscore}.sidekiq"

    ActiveSupport::Notifications.instrument "#{worker_class.class.to_s.underscore}.sidekiq", options do
      yield
    end

    ActiveSupport::Notifications.instrument "job.sidekiq", :counter => true
  else
    logger.debug "Skipped Instrumenting: #{worker_class.inspect}"
    yield
  end
end