Sha256: 3682501c537b0a1bbe75906219491d11fa95942c7566af6e669bc7f1c3015b12
Contents?: true
Size: 967 Bytes
Versions: 2
Compression:
Stored size: 967 Bytes
Contents
# Modified by SignalFx module Sidekiq module Tracer class ServerMiddleware include Commons attr_reader :tracer, :opts def initialize(tracer: nil, opts: {}) @tracer = tracer @opts = opts end def call(worker, job, queue) parent_span_context = extract(job) if opts.fetch(:propagate_context, true) scope = tracer.start_active_span( operation_name(job), child_of: parent_span_context, tags: tags(job, 'server') ) yield rescue Exception => e if scope scope.span.set_tag('error', true) scope.span.log_kv(event: 'error', :'error.object' => e) end raise ensure scope.close if scope end private def extract(job) carrier = job[TRACE_CONTEXT_KEY] return unless carrier tracer.extract(OpenTracing::FORMAT_TEXT_MAP, carrier) end end end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
sfx-sidekiq-opentracing-0.0.4 | lib/sidekiq/tracer/server_middleware.rb |
sfx-sidekiq-opentracing-0.0.3 | lib/sidekiq/tracer/server_middleware.rb |