Sha256: ce09fcb8c850ac532797aa9a3b7f322cb4de89d454a90664a48e04b2b8ffd506

Contents?: true

Size: 929 Bytes

Versions: 16

Compression:

Stored size: 929 Bytes

Contents

require 'determinator/tracking'

module Determinator
  module Tracking
    module Sidekiq
      class Middleware
        # @param [Object] worker the worker instance
        # @param [Hash] job the full job payload
        #   * @see https://github.com/mperham/sidekiq/wiki/Job-Format
        # @param [String] queue the name of the queue the job was pulled from
        # @yield the next middleware in the chain or worker `perform` method
        # @return [Void]
        def call(worker, job, queue)
          begin
            Determinator::Tracking.start!(:sidekiq)
            yield
          rescue => ex
            error = true
            raise
          ensure
            Determinator::Tracking.finish!(
              endpoint: Determinator::Tracking.collect_endpoint_info(worker.class.name),
              queue: queue,
              error: !!error
            )
          end
        end
      end
    end
  end
end

Version data entries

16 entries across 16 versions & 1 rubygems

Version Path
determinator-2.9.3 lib/determinator/tracking/sidekiq/middleware.rb
determinator-2.9.2 lib/determinator/tracking/sidekiq/middleware.rb
determinator-2.9.1 lib/determinator/tracking/sidekiq/middleware.rb
determinator-2.9.0 lib/determinator/tracking/sidekiq/middleware.rb
determinator-2.8.0 lib/determinator/tracking/sidekiq/middleware.rb
determinator-2.7.1 lib/determinator/tracking/sidekiq/middleware.rb
determinator-2.7.0 lib/determinator/tracking/sidekiq/middleware.rb
determinator-2.6.0 lib/determinator/tracking/sidekiq/middleware.rb
determinator-2.5.4 lib/determinator/tracking/sidekiq/middleware.rb
determinator-2.5.3 lib/determinator/tracking/sidekiq/middleware.rb
determinator-2.5.2 lib/determinator/tracking/sidekiq/middleware.rb
determinator-2.5.1 lib/determinator/tracking/sidekiq/middleware.rb
determinator-2.5.0 lib/determinator/tracking/sidekiq/middleware.rb
determinator-2.4.4 lib/determinator/tracking/sidekiq/middleware.rb
determinator-2.4.3 lib/determinator/tracking/sidekiq/middleware.rb
determinator-2.4.2 lib/determinator/tracking/sidekiq/middleware.rb