Module: Datadog::Trace::NetExtensions

Defined in:
lib/datadog/lambda/trace/patch_http.rb

Overview

NetExtensions contains patches which add tracing context to http calls

Instance Method Summary collapse

Instance Method Details

#request(req, body = nil, &block) ⇒ Object



32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
# File 'lib/datadog/lambda/trace/patch_http.rb', line 32

def request(req, body = nil, &block)
  begin
    context = Datadog::Trace.current_trace_context(
      Datadog::Trace.trace_context
    )

    req = add_ctx_to_req(req, context)
  rescue StandardError => e
    trace = e.backtrace.join("\n ")
    Datadog::Utils.logger.debug(
      "couldn't add tracing context #{context} to request #{e}:\n#{trace}"
    )
  end
  super(req, body, &block)
end