Sha256: 5e15b69904c3b4f931c5591c4f398733bab5e1fb3eddc0a257dcf6c3ddf921b3

Contents?: true

Size: 1.39 KB

Versions: 5

Compression:

Stored size: 1.39 KB

Contents

# Modified by SignalFx
require "sidekiq"
require "opentracing"

require "sidekiq/tracer/version"
require "sidekiq/tracer/constants"
require "sidekiq/tracer/commons"
require "sidekiq/tracer/client_middleware"
require "sidekiq/tracer/server_middleware"

module Sidekiq
  module Tracer
    class << self
      def instrument(tracer: OpenTracing.global_tracer, opts: {})
        instrument_client(tracer: tracer, opts: opts)
        instrument_server(tracer: tracer, opts: opts)
      end

      def instrument_client(tracer: OpenTracing.global_tracer, opts: {})
        Sidekiq.configure_client do |config|
          config.client_middleware do |chain|
            chain.add Sidekiq::Tracer::ClientMiddleware, tracer: tracer, opts: opts
          end
        end
      end

      def instrument_server(tracer: OpenTracing.global_tracer, opts: {})
        Sidekiq.configure_server do |config|
          config.client_middleware do |chain|
            chain.add Sidekiq::Tracer::ClientMiddleware, tracer: tracer, opts: opts
          end

          config.server_middleware do |chain|
            chain.add Sidekiq::Tracer::ServerMiddleware, tracer: tracer, opts: opts
          end
        end

        if defined?(Sidekiq::Testing)
          Sidekiq::Testing.server_middleware do |chain|
            chain.add Sidekiq::Tracer::ServerMiddleware, tracer: tracer, opts: opts
          end
        end
      end
    end
  end
end

Version data entries

5 entries across 5 versions & 2 rubygems

Version Path
signalfx-sidekiq-opentracing-0.1.0 lib/sidekiq/tracer.rb
sfx-sidekiq-opentracing-0.0.4 lib/sidekiq/tracer.rb
sfx-sidekiq-opentracing-0.0.3 lib/sidekiq/tracer.rb
sfx-sidekiq-opentracing-0.0.2 lib/sidekiq/tracer.rb
sfx-sidekiq-opentracing-0.0.1 lib/sidekiq/tracer.rb