Module: NewRelic::Security::Instrumentation::AsyncHttp::Chain

Defined in:
lib/newrelic_security/instrumentation-security/async-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/async-http/chain.rb', line 5

def self.instrument!
  ::Async::HTTP::Internet.class_eval do
    include NewRelic::Security::Instrumentation::AsyncHttp

    alias_method :call_without_security, :call
  
    def call(method, url, headers = nil, body = nil)
      retval = nil
      event = call_on_enter(method, url, headers, body) { retval = call_without_security(method, url, headers, body) }
      call_on_exit(event) { return retval }
    end
  end
end