lib/opentelemetry/instrumentation/active_job/handlers/enqueue.rb in opentelemetry-instrumentation-active_job-0.7.6 vs lib/opentelemetry/instrumentation/active_job/handlers/enqueue.rb in opentelemetry-instrumentation-active_job-0.7.7
- old
+ new
@@ -21,11 +21,12 @@
# @return [Hash] with the span and generated context tokens
def start_span(name, _id, payload)
job = payload.fetch(:job)
span_name = span_name(job, EVENT_NAME)
span = tracer.start_span(span_name, kind: :producer, attributes: @mapper.call(payload))
+ token = OpenTelemetry::Context.attach(OpenTelemetry::Trace.context_with_span(span))
OpenTelemetry.propagation.inject(job.__otel_headers) # This must be transmitted over the wire
- { span: span, ctx_token: OpenTelemetry::Context.attach(OpenTelemetry::Trace.context_with_span(span)) }
+ { span: span, ctx_token: token }
end
end
end
end
end