class OpenTelemetry::Instrumentation::Que::Middlewares::ServerMiddleware
def self.call(job, &)
def self.call(job, &) job_class = job_class(job) span_name = "#{job_class} process" attributes = attributes_before_job_completion(job, job_class) extracted_context = extract_context_from_tags(job.que_attrs[:data][:tags] || []) OpenTelemetry::Context.with_current(extracted_context) do if otel_config[:propagation_style] == :child tracer.in_span(span_name, attributes: attributes, kind: :consumer) do |span| yield enhance_span_after_job_completion(span, job) end else span_links = otel_config[:propagation_style] == :link ? prepare_span_links(extracted_context) : [] root_span = tracer.start_root_span(span_name, attributes: attributes, links: span_links, kind: :consumer) OpenTelemetry::Trace.with_span(root_span) do |span| yield enhance_span_after_job_completion(span, job) ensure root_span.finish end end end # return value is not important nil end