Sha256: 59d71717b0efc5bd5405a7e7e6eb2fedcb6079782080799f6c33ef290e3d4d4b

Contents?: true

Size: 1.38 KB

Versions: 33

Compression:

Stored size: 1.38 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.

DependencyDetection.defer do
  named :httpclient

  HTTPCLIENT_MIN_VERSION = '2.2.0'

  depends_on do
    defined?(HTTPClient) && defined?(HTTPClient::VERSION)
  end

  depends_on do
    minimum_supported_version = NewRelic::VersionNumber.new(HTTPCLIENT_MIN_VERSION)
    current_version = NewRelic::VersionNumber.new(HTTPClient::VERSION)

    current_version >= minimum_supported_version
  end

  executes do
    ::NewRelic::Agent.logger.info 'Installing HTTPClient instrumentation'
    require 'new_relic/agent/cross_app_tracing'
    require 'new_relic/agent/http_clients/httpclient_wrappers'
  end

  executes do
    class HTTPClient
      def do_get_block_with_newrelic(req, proxy, conn, &block)
        wrapped_request = NewRelic::Agent::HTTPClients::HTTPClientRequest.new(req)

        response = nil
        ::NewRelic::Agent::CrossAppTracing.tl_trace_http_request(wrapped_request) do
          do_get_block_without_newrelic(req, proxy, conn, &block)
          response = conn.pop
          conn.push response
          ::NewRelic::Agent::HTTPClients::HTTPClientResponse.new(response)
        end
        response
      end

      alias do_get_block_without_newrelic do_get_block
      alias do_get_block do_get_block_with_newrelic
    end
  end
end

Version data entries

33 entries across 33 versions & 2 rubygems

Version Path
newrelic_rpm-3.17.2.327 lib/new_relic/agent/instrumentation/httpclient.rb
newrelic_rpm-3.17.1.326 lib/new_relic/agent/instrumentation/httpclient.rb
newrelic_rpm-3.17.0.325 lib/new_relic/agent/instrumentation/httpclient.rb
newrelic_rpm-3.16.3.323 lib/new_relic/agent/instrumentation/httpclient.rb
newrelic_rpm-3.16.2.321 lib/new_relic/agent/instrumentation/httpclient.rb
newrelic_rpm-3.16.1.320 lib/new_relic/agent/instrumentation/httpclient.rb
newrelic_rpm-3.16.0.318 lib/new_relic/agent/instrumentation/httpclient.rb
ish_lib_manager-0.0.1 test/dummy/vendor/bundle/ruby/2.3.0/gems/newrelic_rpm-3.15.2.317/lib/new_relic/agent/instrumentation/httpclient.rb
newrelic_rpm-3.15.2.317 lib/new_relic/agent/instrumentation/httpclient.rb
newrelic_rpm-3.15.1.316 lib/new_relic/agent/instrumentation/httpclient.rb
newrelic_rpm-3.15.0.314 lib/new_relic/agent/instrumentation/httpclient.rb
newrelic_rpm-3.14.3.313 lib/new_relic/agent/instrumentation/httpclient.rb
newrelic_rpm-3.14.2.312 lib/new_relic/agent/instrumentation/httpclient.rb
newrelic_rpm-3.14.1.311 lib/new_relic/agent/instrumentation/httpclient.rb
newrelic_rpm-3.14.0.305 lib/new_relic/agent/instrumentation/httpclient.rb
newrelic_rpm-3.13.2.302 lib/new_relic/agent/instrumentation/httpclient.rb
newrelic_rpm-3.13.1.300 lib/new_relic/agent/instrumentation/httpclient.rb
newrelic_rpm-3.13.0.299 lib/new_relic/agent/instrumentation/httpclient.rb
newrelic_rpm-3.12.1.298 lib/new_relic/agent/instrumentation/httpclient.rb
newrelic_rpm-3.12.0.288 lib/new_relic/agent/instrumentation/httpclient.rb