class Excon::Connection

Public Class Methods

install_newrelic_instrumentation() click to toggle source
# File lib/new_relic/agent/instrumentation/excon/connection.rb, line 27
def self.install_newrelic_instrumentation
  alias request_without_newrelic_trace request
  alias request request_with_newrelic_trace
end

Public Instance Methods

newrelic_connection_params() click to toggle source
# File lib/new_relic/agent/instrumentation/excon/connection.rb, line 6
def newrelic_connection_params
  (@connection || @data)
end
newrelic_resolved_request_params(request_params) click to toggle source
# File lib/new_relic/agent/instrumentation/excon/connection.rb, line 10
def newrelic_resolved_request_params(request_params)
  resolved = newrelic_connection_params.merge(request_params)
  resolved[:headers] = resolved[:headers].merge(request_params[:headers] || {})
  resolved
end
request_with_newrelic_trace(params, &block) click to toggle source
# File lib/new_relic/agent/instrumentation/excon/connection.rb, line 16
def request_with_newrelic_trace(params, &block)
  orig_response = nil
  resolved_params = newrelic_resolved_request_params(params)
  wrapped_request = ::NewRelic::Agent::HTTPClients::ExconHTTPRequest.new(resolved_params)
  ::NewRelic::Agent::CrossAppTracing.tl_trace_http_request(wrapped_request) do
    orig_response = request_without_newrelic_trace(resolved_params, &block)
    ::NewRelic::Agent::HTTPClients::ExconHTTPResponse.new(orig_response)
  end
  orig_response
end