Sha256: 864c00881ab54710808e3268b48782170e3e93e7181d1e3ba631c1c6dafb930a

Contents?: true

Size: 420 Bytes

Versions: 5

Compression:

Stored size: 420 Bytes

Contents

module Sidekiq
  module Tracer
    class ServerMiddleware
      def call(worker, msg, queue)
        with_trace(msg["root_trace"]) { yield }
      end

      private

      def with_trace(value)
        Thread.current[:sidekiq_root_trace] ||= []
        Thread.current[:sidekiq_root_trace] << value unless value.nil?
        yield
      ensure
        Thread.current[:sidekiq_root_trace].pop
      end
    end
  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
sidekiq-tracer-0.1.4 lib/sidekiq/tracer/server_middleware.rb
sidekiq-tracer-0.1.3 lib/sidekiq/tracer/server_middleware.rb
sidekiq-tracer-0.1.2 lib/sidekiq/tracer/server_middleware.rb
sidekiq-tracer-0.1.1 lib/sidekiq/tracer/server_middleware.rb
sidekiq-tracer-0.1.0 lib/sidekiq/tracer/server_middleware.rb