Sha256: 248429d4b92b50c48254849e6eb5ab0a0f8067a737a414e681cb3cf5116f942d
Contents?: true
Size: 1.69 KB
Versions: 3
Compression:
Stored size: 1.69 KB
Contents
# frozen_string_literal: true require "sidekiq" 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, active_span: nil, after_trace: nil) instrument_client(tracer: tracer, active_span: active_span) instrument_server(tracer: tracer, active_span: active_span, after_trace: after_trace) end def instrument_client(tracer: OpenTracing.global_tracer, active_span: nil) Sidekiq.configure_client do |config| config.client_middleware { |chain| add_client_middleware(chain, tracer, active_span) } end end def instrument_server(tracer: OpenTracing.global_tracer, active_span: nil, after_trace: nil) Sidekiq.configure_server do |config| config.client_middleware { |chain| add_client_middleware(chain, tracer, active_span) } config.server_middleware { |chain| add_server_middleware(chain, tracer, active_span, after_trace) } end return unless defined?(Sidekiq::Testing) Sidekiq::Testing.server_middleware { |chain| add_server_middleware(chain, tracer, active_span, after_trace) } end def add_client_middleware(chain, tracer, active_span) chain.add Sidekiq::Tracer::ClientMiddleware, tracer: tracer, active_span: active_span end def add_server_middleware(chain, tracer, active_span, after_trace) chain.add Sidekiq::Tracer::ServerMiddleware, tracer: tracer, active_span: active_span, after_trace: after_trace end end end end
Version data entries
3 entries across 3 versions & 1 rubygems
Version | Path |
---|---|
sidekiq-instrumentation-1.2.2 | lib/sidekiq/tracer.rb |
sidekiq-instrumentation-1.2.2.ejacobs2 | lib/sidekiq/tracer.rb |
sidekiq-instrumentation-1.2.2.ejacobs1 | lib/sidekiq/tracer.rb |