Class: Labkit::Middleware::Sidekiq::Server

Inherits:
Object
  • Object
show all
Defined in:
lib/labkit/middleware/sidekiq/server.rb

Overview

This is a wrapper around all the sidekiq server-middleware in labkit The only middleware that needs to be added to the chain in GitLab-rails

It uses a new ‘Sidekiq::Middleware::Chain` to string multiple middlewares together.

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.chainObject



12
13
14
15
16
17
# File 'lib/labkit/middleware/sidekiq/server.rb', line 12

def self.chain
  @chain ||= ::Sidekiq::Middleware::Chain.new do |chain|
    chain.add Labkit::Middleware::Sidekiq::Context::Server
    chain.add Labkit::Middleware::Sidekiq::Tracing::Server if Labkit::Tracing.enabled?
  end
end

Instance Method Details

#call(*args) ⇒ Object



19
20
21
22
23
# File 'lib/labkit/middleware/sidekiq/server.rb', line 19

def call(*args)
  self.class.chain.invoke(*args) do
    yield
  end
end