BigW Consortium Gitlab

sidekiq_middleware.rb 409 Bytes
Newer Older
1 2 3 4 5 6 7
module Gitlab
  module Metrics
    # Sidekiq middleware for tracking jobs.
    #
    # This middleware is intended to be used as a server-side middleware.
    class SidekiqMiddleware
      def call(worker, message, queue)
8
        trans = Transaction.new("#{worker.class.name}#perform")
9 10 11 12 13 14 15 16 17 18

        begin
          trans.run { yield }
        ensure
          trans.finish
        end
      end
    end
  end
end