Class: BrainzLab::Instrumentation::AWSInstrumentation::BrainzLabPlugin::Handler

Inherits:
Object
  • Object
show all
Defined in:
lib/brainzlab/instrumentation/aws.rb

Instance Method Summary collapse

Constructor Details

#initialize(handler) ⇒ Handler

Returns a new instance of Handler.



109
110
111
# File 'lib/brainzlab/instrumentation/aws.rb', line 109

def initialize(handler)
  @handler = handler
end

Instance Method Details

#call(context) ⇒ Object



113
114
115
116
117
118
119
120
121
122
123
124
125
126
# File 'lib/brainzlab/instrumentation/aws.rb', line 113

def call(context)
  started_at = Time.now
  service = extract_service(context)
  operation = context.operation_name.to_s

  begin
    response = @handler.call(context)
    track_request(service, operation, started_at, context, response)
    response
  rescue StandardError => e
    track_error(service, operation, started_at, context, e)
    raise
  end
end