Module: Skylight::Core::Sidekiq

Defined in:
lib/skylight/core/sidekiq.rb

Defined Under Namespace

Classes: ServerMiddleware

Class Method Summary collapse

Class Method Details

.add_middleware(instrumentable) ⇒ Object



4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
# File 'lib/skylight/core/sidekiq.rb', line 4

def self.add_middleware(instrumentable)
  unless defined?(::Sidekiq)
    instrumentable.warn "Skylight for Sidekiq is active, but Sidekiq is not defined."
    return
  end

  ::Sidekiq.configure_server do |sidekiq_config|
    instrumentable.debug "Adding Sidekiq Middleware"

    sidekiq_config.server_middleware do |chain|
      # Put it at the front
      chain.prepend ServerMiddleware, instrumentable
    end
  end
end