Sha256: 78a4377d0d779dffdc2c1f8d9b944b2f4ee4cfed815489b64fcfd1f2e6750e07

Contents?: true

Size: 1.15 KB

Versions: 21

Compression:

Stored size: 1.15 KB

Contents

# encoding: utf-8
# This file is distributed under New Relic's license terms.
# See https://github.com/newrelic/rpm/blob/master/LICENSE for complete details.

module ::Excon
  class Connection
    def newrelic_connection_params
      (@connection || @data)
    end

    def newrelic_resolved_request_params(request_params)
      resolved = newrelic_connection_params.merge(request_params)
      resolved[:headers] = resolved[:headers].merge(request_params[:headers] || {})
      resolved
    end

    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

    def self.install_newrelic_instrumentation
      alias request_without_newrelic_trace request
      alias request request_with_newrelic_trace
    end
  end
end

Version data entries

21 entries across 21 versions & 1 rubygems

Version Path
newrelic_rpm-3.9.0.229 lib/new_relic/agent/instrumentation/excon/connection.rb
newrelic_rpm-3.8.1.221 lib/new_relic/agent/instrumentation/excon/connection.rb
newrelic_rpm-3.8.0.218 lib/new_relic/agent/instrumentation/excon/connection.rb
newrelic_rpm-3.7.3.204 lib/new_relic/agent/instrumentation/excon/connection.rb
newrelic_rpm-3.7.3.199 lib/new_relic/agent/instrumentation/excon/connection.rb
newrelic_rpm-3.7.2.195 lib/new_relic/agent/instrumentation/excon/connection.rb
newrelic_rpm-3.7.2.192 lib/new_relic/agent/instrumentation/excon/connection.rb
newrelic_rpm-3.7.2.190.beta lib/new_relic/agent/instrumentation/excon/connection.rb
newrelic_rpm-3.7.1.188 lib/new_relic/agent/instrumentation/excon/connection.rb
newrelic_rpm-3.7.1.182 lib/new_relic/agent/instrumentation/excon/connection.rb
newrelic_rpm-3.7.1.180 lib/new_relic/agent/instrumentation/excon/connection.rb
newrelic_rpm-3.7.0.177 lib/new_relic/agent/instrumentation/excon/connection.rb
newrelic_rpm-3.7.0.174.beta lib/new_relic/agent/instrumentation/excon/connection.rb
newrelic_rpm-3.6.9.171 lib/new_relic/agent/instrumentation/excon/connection.rb
newrelic_rpm-3.6.8.168 lib/new_relic/agent/instrumentation/excon/connection.rb
newrelic_rpm-3.6.8.164 lib/new_relic/agent/instrumentation/excon/connection.rb
newrelic_rpm-3.6.7.159 lib/new_relic/agent/instrumentation/excon/connection.rb
newrelic_rpm-3.6.7.159.beta lib/new_relic/agent/instrumentation/excon/connection.rb
newrelic_rpm-3.6.7.152 lib/new_relic/agent/instrumentation/excon/connection.rb
newrelic_rpm-3.6.6.147 lib/new_relic/agent/instrumentation/excon/connection.rb