Module: AppPerfRpm::Instruments::FaradayConnection

Defined in:
lib/app_perf_rpm/instruments/faraday.rb

Instance Method Summary collapse

Instance Method Details

#run_request_with_trace(method, url, body, headers, &block) ⇒ Object



4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
# File 'lib/app_perf_rpm/instruments/faraday.rb', line 4

def run_request_with_trace(method, url, body, headers, &block)
  if ::AppPerfRpm.tracing?
    span = ::AppPerfRpm::Tracer.start_span("faraday")
    result = run_request_without_trace(method, url, body, headers, &block)
    span.finish
    span.options = {
      "middleware" => @builder.handlers,
      "protocol" => @url_prefix.scheme,
      "remote_host" => @url_prefix.host,
      "remote_port" => @url_prefix.port,
      "service_url" => url,
      "http_method" => method,
      "http_status" => result.status
    }
    span.submit(opts)

    result
  else
    run_request_without_trace(method, url, body, headers, &block)
  end
end