Sha256: 8778ad49a28ccad14b3d340db595430af142be4bbc695d0b34b6911fa2b6382e

Contents?: true

Size: 1.14 KB

Versions: 9

Compression:

Stored size: 1.14 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
  @name = :net

  depends_on do
    defined?(Net) && defined?(Net::HTTP)
  end

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

  executes do
    class Net::HTTP
      # Instrument outgoing HTTP requests
      #
      # If request is called when not the connection isn't started, request
      # will call back into itself (via a start block).
      #
      # Don't tracing until the inner call then to avoid double-counting.
      def request_with_newrelic_trace(request, *args, &block)
        if started?
          NewRelic::Agent::CrossAppTracing.trace_http_request( self, request ) do
            request_without_newrelic_trace( request, *args, &block )
          end
        else
          request_without_newrelic_trace( request, *args, &block )
        end
      end

      alias request_without_newrelic_trace request
      alias request request_with_newrelic_trace
    end
  end
end

Version data entries

9 entries across 9 versions & 1 rubygems

Version Path
newrelic_rpm-3.6.4.122 lib/new_relic/agent/instrumentation/net.rb
newrelic_rpm-3.6.4.113.beta lib/new_relic/agent/instrumentation/net.rb
newrelic_rpm-3.6.3.111 lib/new_relic/agent/instrumentation/net.rb
newrelic_rpm-3.6.3.106 lib/new_relic/agent/instrumentation/net.rb
newrelic_rpm-3.6.3.105.beta lib/new_relic/agent/instrumentation/net.rb
newrelic_rpm-3.6.3.104 lib/new_relic/agent/instrumentation/net.rb
newrelic_rpm-3.6.3.103.beta lib/new_relic/agent/instrumentation/net.rb
newrelic_rpm-3.6.2.96 lib/new_relic/agent/instrumentation/net.rb
newrelic_rpm-3.6.2.90.beta lib/new_relic/agent/instrumentation/net.rb