Sha256: 423253ca29a3297a18bc882a52a75161ad1bde3a59c9c018135c130366d415b5

Contents?: true

Size: 1.13 KB

Versions: 10

Compression:

Stored size: 1.13 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'
    require 'new_relic/agent/http_clients/net_http_wrappers'
  end

  executes do
    class Net::HTTP
      def request_with_newrelic_trace(request, *args, &block)
        wrapped_request = NewRelic::Agent::HTTPClients::NetHTTPRequest.new(self, request)

        NewRelic::Agent::CrossAppTracing.trace_http_request( wrapped_request ) do
          # RUBY-1244 Disable further tracing in request to avoid double
          # counting if connection wasn't started (which calls request again).
          NewRelic::Agent.disable_all_tracing do
            request_without_newrelic_trace( request, *args, &block )
          end
        end
      end

      alias request_without_newrelic_trace request
      alias request request_with_newrelic_trace
    end
  end
end

Version data entries

10 entries across 10 versions & 1 rubygems

Version Path
newrelic_rpm-3.8.1.221 lib/new_relic/agent/instrumentation/net.rb
newrelic_rpm-3.8.0.218 lib/new_relic/agent/instrumentation/net.rb
newrelic_rpm-3.7.3.204 lib/new_relic/agent/instrumentation/net.rb
newrelic_rpm-3.7.3.199 lib/new_relic/agent/instrumentation/net.rb
newrelic_rpm-3.7.2.195 lib/new_relic/agent/instrumentation/net.rb
newrelic_rpm-3.7.2.192 lib/new_relic/agent/instrumentation/net.rb
newrelic_rpm-3.7.2.190.beta lib/new_relic/agent/instrumentation/net.rb
newrelic_rpm-3.7.1.188 lib/new_relic/agent/instrumentation/net.rb
newrelic_rpm-3.7.1.182 lib/new_relic/agent/instrumentation/net.rb
newrelic_rpm-3.7.1.180 lib/new_relic/agent/instrumentation/net.rb