Sha256: 819cfc1124ed0e1ecaea215339438222a3e309f226a767b32c733f59c383edde

Contents?: true

Size: 814 Bytes

Versions: 4

Compression:

Stored size: 814 Bytes

Contents

DependencyDetection.defer do
  depends_on do
    defined?(Net) && defined?(Net::HTTP)
  end
  
  executes do
    NewRelic::Agent.logger.debug 'Installing Net instrumentation'
  end
  
  executes do
    Net::HTTP.class_eval do
      def request_with_newrelic_trace(*args, &block)
        metrics = ["External/#{@address}/Net::HTTP/#{args[0].method}","External/#{@address}/all"]
        if NewRelic::Agent::Instrumentation::MetricFrame.recording_web_transaction?
          metrics << "External/allWeb"
        else
          metrics << "External/allOther"
        end
        self.class.trace_execution_scoped metrics do
          request_without_newrelic_trace(*args, &block)
        end
      end
      alias request_without_newrelic_trace request
      alias request request_with_newrelic_trace
    end
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
newrelic_rpm-3.1.1 lib/new_relic/agent/instrumentation/net.rb
newrelic_rpm-3.1.1.beta3 lib/new_relic/agent/instrumentation/net.rb
newrelic_rpm-3.1.1.beta2 lib/new_relic/agent/instrumentation/net.rb
newrelic_rpm-3.1.1.beta1 lib/new_relic/agent/instrumentation/net.rb