lib/opentelemetry/instrumentation/active_job/handlers/perform.rb in opentelemetry-instrumentation-active_job-0.7.6 vs lib/opentelemetry/instrumentation/active_job/handlers/perform.rb in opentelemetry-instrumentation-active_job-0.7.7
- old
+ new
@@ -25,10 +25,10 @@
parent_context = OpenTelemetry.propagation.extract(job.__otel_headers)
# TODO: Refactor into a propagation strategy
propagation_style = @config[:propagation_style]
if propagation_style == :child
- span = tracer.start_span(span_name, kind: :consumer, attributes: @mapper.call(payload))
+ span = tracer.start_span(span_name, with_parent: parent_context, kind: :consumer, attributes: @mapper.call(payload))
else
span_context = OpenTelemetry::Trace.current_span(parent_context).context
links = [OpenTelemetry::Trace::Link.new(span_context)] if span_context.valid? && propagation_style == :link
span = tracer.start_root_span(span_name, kind: :consumer, attributes: @mapper.call(payload), links: links)
end