Sha256: 645cbc5a605471c5b9febd2beb95382819dc6957b17215ee4577422b4e6be241

Contents?: true

Size: 847 Bytes

Versions: 61

Compression:

Stored size: 847 Bytes

Contents

DependencyDetection.defer do
  @name = :net

  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", "External/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

61 entries across 61 versions & 4 rubygems

Version Path
newrelic_rpm-3.2.0.beta1 lib/new_relic/agent/instrumentation/net.rb