Class: OpenTelemetry::Instrumentation::AwsLambda::Handler
- Inherits:
-
Object
- Object
- OpenTelemetry::Instrumentation::AwsLambda::Handler
- Extended by:
- Wrap
- Defined in:
- lib/opentelemetry/instrumentation/aws_lambda/handler.rb
Overview
Handler class that creates a span around the _HANDLER
Constant Summary
Constants included from Wrap
Wrap::AWS_TRIGGERS, Wrap::DEFAULT_FLUSH_TIMEOUT
Instance Attribute Summary collapse
-
#handler_class ⇒ Object
readonly
Returns the value of attribute handler_class.
-
#handler_method ⇒ Object
readonly
Returns the value of attribute handler_method.
Instance Method Summary collapse
-
#call_wrapped(event:, context:) ⇒ Object
Try to record and re-raise any exception from the wrapped function handler Instrumentation should never raise its own exception.
-
#initialize ⇒ Handler
constructor
anytime when the code in a Lambda function is updated or the functional configuration is changed, the next invocation results in a cold start; therefore these instance variables will be up-to-date.
Methods included from Wrap
instrument_handler, instrumentation_config, tracer, wrap_lambda
Constructor Details
#initialize ⇒ Handler
anytime when the code in a Lambda function is updated or the functional configuration is changed, the next invocation results in a cold start; therefore these instance variables will be up-to-date
18 19 20 21 22 23 24 25 26 |
# File 'lib/opentelemetry/instrumentation/aws_lambda/handler.rb', line 18 def initialize @flush_timeout = ENV.fetch('OTEL_INSTRUMENTATION_AWS_LAMBDA_FLUSH_TIMEOUT', '30000').to_i @original_handler = ENV['ORIG_HANDLER'] || ENV['_HANDLER'] || '' @handler_class = nil @handler_method = nil @handler_file = nil resolve_original_handler end |
Instance Attribute Details
#handler_class ⇒ Object (readonly)
Returns the value of attribute handler_class.
14 15 16 |
# File 'lib/opentelemetry/instrumentation/aws_lambda/handler.rb', line 14 def handler_class @handler_class end |
#handler_method ⇒ Object (readonly)
Returns the value of attribute handler_method.
14 15 16 |
# File 'lib/opentelemetry/instrumentation/aws_lambda/handler.rb', line 14 def handler_method @handler_method end |
Instance Method Details
#call_wrapped(event:, context:) ⇒ Object
Try to record and re-raise any exception from the wrapped function handler Instrumentation should never raise its own exception
30 31 32 33 34 |
# File 'lib/opentelemetry/instrumentation/aws_lambda/handler.rb', line 30 def call_wrapped(event:, context:) self.class.wrap_lambda(event: event, context: context, handler: @original_handler, flush_timeout: @flush_timeout) do call_original_handler(event: event, context: context) end end |