Class: Metrician::Sidekiq

Inherits:
Reporter show all
Defined in:
lib/metrician/reporters/sidekiq.rb

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from Reporter

all, inherited

Class Method Details

.enabled?Boolean

Returns:

  • (Boolean)


4
5
6
7
# File 'lib/metrician/reporters/sidekiq.rb', line 4

def self.enabled?
  !!defined?(::Sidekiq) &&
    Metrician::Jobs.enabled?
end

Instance Method Details

#instrumentObject



9
10
11
12
13
14
15
16
# File 'lib/metrician/reporters/sidekiq.rb', line 9

def instrument
  require "metrician/jobs/sidekiq_middleware"
  ::Sidekiq.configure_server do |config|
    config.server_middleware do |chain|
      chain.add ::Metrician::Jobs::SidekiqMiddleware
    end
  end
end