Class: Excon::Connection
- Inherits:
-
Object
- Object
- Excon::Connection
- Defined in:
- lib/new_relic/agent/instrumentation/excon/connection.rb
Class Method Summary collapse
Instance Method Summary collapse
- #newrelic_connection_params ⇒ Object
- #newrelic_resolved_request_params(request_params) ⇒ Object
- #request_with_newrelic_trace(params, &block) ⇒ Object
Class Method Details
.install_newrelic_instrumentation ⇒ Object
28 29 30 31 |
# File 'lib/new_relic/agent/instrumentation/excon/connection.rb', line 28 def self.install_newrelic_instrumentation alias request_without_newrelic_trace request alias request request_with_newrelic_trace end |
Instance Method Details
#newrelic_connection_params ⇒ Object
7 8 9 |
# File 'lib/new_relic/agent/instrumentation/excon/connection.rb', line 7 def newrelic_connection_params (@connection || @data) end |
#newrelic_resolved_request_params(request_params) ⇒ Object
11 12 13 14 15 |
# File 'lib/new_relic/agent/instrumentation/excon/connection.rb', line 11 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) ⇒ Object
17 18 19 20 21 22 23 24 25 26 |
# File 'lib/new_relic/agent/instrumentation/excon/connection.rb', line 17 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.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 |