Class: Sidekiq::Tracer::ClientMiddleware

Inherits:
Object
  • Object
show all
Includes:
Commons
Defined in:
lib/sidekiq/tracer/client_middleware.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods included from Commons

#operation_name, #tags

Constructor Details

#initialize(tracer, active_span) ⇒ ClientMiddleware

Returns a new instance of ClientMiddleware.



10
11
12
13
# File 'lib/sidekiq/tracer/client_middleware.rb', line 10

def initialize(tracer, active_span)
  @tracer = tracer
  @active_span = active_span
end

Instance Attribute Details

#active_spanObject (readonly)

Returns the value of attribute active_span.



8
9
10
# File 'lib/sidekiq/tracer/client_middleware.rb', line 8

def active_span
  @active_span
end

#tracerObject (readonly)

Returns the value of attribute tracer.



8
9
10
# File 'lib/sidekiq/tracer/client_middleware.rb', line 8

def tracer
  @tracer
end

Instance Method Details

#call(_worker_class, job, _queue, _redis_pool) ⇒ Object



15
16
17
18
19
20
21
22
23
24
25
26
# File 'lib/sidekiq/tracer/client_middleware.rb', line 15

def call(_worker_class, job, _queue, _redis_pool)
  span = build_span(job)

  inject(span, job)

  yield
rescue StandardError => e
  tag_errors(span, e) if span
  raise
ensure
  span&.finish
end