File tree Expand file tree Collapse file tree 2 files changed +10
-1
lines changed
instrumentation/opentelemetry-instrumentation-aws-lambda
src/opentelemetry/instrumentation/aws_lambda Expand file tree Collapse file tree 2 files changed +10
-1
lines changed Original file line number Diff line number Diff line change @@ -342,7 +342,7 @@ def _instrumented_lambda_handler_call( # noqa pylint: disable=too-many-branches
342342 # If the request came from an API Gateway, extract http attributes from the event
343343 # https://github.com/open-telemetry/opentelemetry-specification/blob/main/specification/trace/semantic_conventions/instrumentation/aws-lambda.md#api-gateway
344344 # https://github.com/open-telemetry/opentelemetry-specification/blob/main/specification/trace/semantic_conventions/http.md#http-server-semantic-conventions
345- if lambda_event and lambda_event .get ("requestContext" ):
345+ if isinstance ( lambda_event , dict ) and lambda_event .get ("requestContext" ):
346346 span .set_attribute (SpanAttributes .FAAS_TRIGGER , "http" )
347347
348348 if lambda_event .get ("version" ) == "2.0" :
Original file line number Diff line number Diff line change @@ -399,6 +399,15 @@ def test_api_gateway_http_api_proxy_event_sets_attributes(self):
399399 },
400400 )
401401
402+ def test_lambda_handles_list_event (self ):
403+ AwsLambdaInstrumentor ().instrument ()
404+
405+ mock_execute_lambda ([{"message" : "test" }])
406+
407+ spans = self .memory_exporter .get_finished_spans ()
408+
409+ assert spans
410+
402411 def test_uninstrument (self ):
403412 AwsLambdaInstrumentor ().instrument ()
404413
You can’t perform that action at this time.
0 commit comments