Module: NewRelic::Agent::Instrumentation::Ethon::Chain

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

Class Method Summary collapse

Class Method Details

.instrument!Object



8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
# File 'lib/new_relic/agent/instrumentation/ethon/chain.rb', line 8

def self.instrument!
  ::Ethon::Easy.class_eval do
    include NewRelic::Agent::Instrumentation::Ethon::Easy

    alias_method(:fabricate_without_tracing, :fabricate)
    def fabricate(url, action_name, options)
      fabricate_with_tracing(url, action_name, options) { fabricate_without_tracing(url, action_name, options) }
    end

    alias_method(:headers_equals_without_tracing, :headers=)
    def headers=(headers)
      headers_equals_with_tracing(headers) { headers_equals_without_tracing(headers) }
    end

    alias_method(:perform_without_tracing, :perform)
    def perform(*args)
      perform_with_tracing(*args) { perform_without_tracing(*args) }
    end
  end

  ::Ethon::Multi.class_eval do
    include NewRelic::Agent::Instrumentation::Ethon::Multi

    alias_method(:perform_without_tracing, :perform)
    def perform(*args)
      perform_with_tracing(*args) { perform_without_tracing(*args) }
    end
  end
end