Module: NewRelic::Security::Instrumentation::NetHTTP::Chain

Defined in:
lib/newrelic_security/instrumentation-security/net_http/chain.rb

Class Method Summary collapse

Class Method Details

.instrument!Object



5
6
7
8
9
10
11
12
13
14
15
16
17
# File 'lib/newrelic_security/instrumentation-security/net_http/chain.rb', line 5

def self.instrument!
  ::Net::HTTP.class_eval do
    include NewRelic::Security::Instrumentation::NetHTTP

    alias_method :transport_request_without_security, :transport_request
  
    def transport_request(req, &block)
      retval = nil
      event = transport_request_on_enter(req) { retval = transport_request_without_security(req, &block) }
      transport_request_on_exit(event) { return retval }
    end
  end
end