module AWS
Public Class Methods
handler(event:, context:, &block)
click to toggle source
# File lib/stackify_ruby_apm_lambda.rb, line 12 def self.handler(event:, context:, &block) begin ctx = StackifyRubyAPM::Context.new ctx.add_aws_context({:arn => context.invoked_function_arn}) transaction = StackifyRubyAPM.transaction context.function_name, 'TASK', context: ctx ret = block.call rescue StackifyRubyAPM::InternalError raise # Don't report StackifyRubyAPM errors rescue StandardError => e StackifyRubyAPM.report e raise e ensure transaction.submit() end ret end
instrument()
click to toggle source
# File lib/stackify_ruby_apm_lambda.rb, line 4 def self.instrument config = { transport: 'logging', queue: false, } StackifyRubyAPM.start config end
stackify_handler(event:, context:)
click to toggle source
STACKIFY LAMBDA HANDLER
@return original function execution
# File lib/stackify_ruby_apm_lambda.rb, line 32 def self.stackify_handler(event:, context:) begin if !StackifyRubyAPM.running? config = { transport: 'logging', queue: false, } StackifyRubyAPM.start config end ctx = StackifyRubyAPM::Context.new ctx.add_aws_context({:arn => context.invoked_function_arn}) transaction = StackifyRubyAPM.transaction context.function_name, 'TASK', context: ctx lambda_handler = StackifyRubyAPM.agent.config.lambda_handler.split('.') function_file = lambda_handler[0] function_name = lambda_handler[-1] require "./#{function_file}" send(function_name, event: event, context: context) rescue StackifyRubyAPM::InternalError raise # Don't report StackifyRubyAPM errors rescue StandardError => e StackifyRubyAPM.report e raise e ensure transaction.submit() end end