lib/ddtrace/contrib/http/instrumentation.rb in ddtrace-0.24.0 vs lib/ddtrace/contrib/http/instrumentation.rb in ddtrace-0.25.0

- old
+ new

@@ -52,30 +52,21 @@ module InstanceMethods def request(req, body = nil, &block) # :yield: +response+ pin = datadog_pin return super(req, body, &block) unless pin && pin.tracer - transport = pin.tracer.writer.transport - - if Datadog::Contrib::HTTP.should_skip_tracing?(req, @address, @port, transport, pin) + if Datadog::Contrib::HTTP.should_skip_tracing?(req, @address, @port, pin.tracer) return super(req, body, &block) end pin.tracer.trace(Ext::SPAN_REQUEST) do |span| begin span.service = pin.service span.span_type = Datadog::Ext::HTTP::TYPE_OUTBOUND span.resource = req.method if pin.tracer.enabled && !Datadog::Contrib::HTTP.should_skip_distributed_tracing?(pin) - req.add_field(Datadog::Ext::DistributedTracing::HTTP_HEADER_TRACE_ID, span.trace_id) - req.add_field(Datadog::Ext::DistributedTracing::HTTP_HEADER_PARENT_ID, span.span_id) - if span.context.sampling_priority - req.add_field( - Datadog::Ext::DistributedTracing::HTTP_HEADER_SAMPLING_PRIORITY, - span.context.sampling_priority - ) - end + Datadog::HTTPPropagator.inject!(span.context, req) end rescue StandardError => e Datadog::Tracer.log.error("error preparing span for http request: #{e}") ensure response = super(req, body, &block)