Module: AwsSdkLambda::Chain

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

Class Method Summary collapse

Class Method Details

.instrument!Object



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

def self.instrument!
  ::Aws::Lambda::Client.class_eval do
    include NewRelic::Agent::Instrumentation::AwsSdkLambda

    alias_method(:invoke_without_new_relic, :invoke)

    def invoke(*args)
      invoke_with_new_relic(*args) { invoke_without_new_relic(*args) }
    end

    alias_method(:invoke_async_without_new_relic, :invoke_async)

    def invoke_async(*args)
      invoke_async_with_new_relic(*args) { invoke_async_without_new_relic(*args) }
    end

    alias_method(:invoke_with_response_stream_without_new_relic, :invoke_with_response_stream)

    def invoke_with_response_stream(*args)
      invoke_with_response_stream_with_new_relic(*args) { invoke_with_response_stream_without_new_relic(*args) }
    end
  end
end