Class: Labkit::Middleware::Sidekiq::Tracing::Server

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

Overview

Server provides a sidekiq server middleware for instrumenting distributed tracing calls when they are executed by the Sidekiq server

Constant Summary collapse

SPAN_KIND =
"server"

Instance Method Summary collapse

Methods included from SidekiqCommon

#job_class, #tags_from_job, #wrapped?

Instance Method Details

#call(_worker, job, _queue) ⇒ Object



17
18
19
20
21
# File 'lib/labkit/middleware/sidekiq/tracing/server.rb', line 17

def call(_worker, job, _queue)
  context = Labkit::Tracing::TracingUtils.tracer.extract(OpenTracing::FORMAT_TEXT_MAP, job)

  Labkit::Tracing::TracingUtils.with_tracing(operation_name: "sidekiq:#{job_class(job)}", child_of: context, tags: tags_from_job(job, SPAN_KIND)) { |_span| yield }
end