Class: Labkit::Tracing::Sidekiq::ClientMiddleware

Inherits:
Object
  • Object
show all
Includes:
SidekiqCommon
Defined in:
lib/labkit/tracing/sidekiq/client_middleware.rb

Constant Summary collapse

SPAN_KIND =
'client'

Instance Method Summary collapse

Methods included from SidekiqCommon

#tags_from_job

Methods included from Common

#in_tracing_span, #kv_tags_for_exception, #log_exception_on_span, #postnotify_span, #tracer

Instance Method Details

#call(worker_class, job, queue, redis_pool) ⇒ Object



13
14
15
16
17
18
19
20
21
# File 'lib/labkit/tracing/sidekiq/client_middleware.rb', line 13

def call(worker_class, job, queue, redis_pool)
  in_tracing_span(operation_name: "sidekiq:#{job['class']}", tags: tags_from_job(job, SPAN_KIND)) do |span|
    # Inject the details directly into the job
    tracer
      .inject(span.context, OpenTracing::FORMAT_TEXT_MAP, job)

    yield
  end
end