Module: AsyncHttp::Chain

Defined in:
lib/new_relic/agent/instrumentation/async_http/chain.rb

Class Method Summary collapse

Class Method Details

.instrument!Object



9
10
11
12
13
14
15
16
17
18
19
20
21
# File 'lib/new_relic/agent/instrumentation/async_http/chain.rb', line 9

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

    alias_method(:call_without_new_relic, :call)

    def call(method, url, headers = nil, body = nil)
      call_with_new_relic(method, url, headers, body) do |hdr|
        call_without_new_relic(method, url, hdr, body)
      end
    end
  end
end