File tree 3 files changed +17
-1
lines changed
instrumentation/opentelemetry-instrumentation-aws-lambda
src/opentelemetry/instrumentation/aws_lambda
3 files changed +17
-1
lines changed Original file line number Diff line number Diff line change @@ -16,6 +16,11 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
16
16
- Make Django request span attributes available for ` start_span ` .
17
17
([ #1730 ] ( https://github.com/open-telemetry/opentelemetry-python-contrib/pull/1730 ) )
18
18
19
+ ### Fixed
20
+
21
+ - Fix ` AttributeError ` when AWS Lambda handler receives a list event
22
+ ([ #1738 ] ( https://github.com/open-telemetry/opentelemetry-python-contrib/pull/1738 ) )
23
+
19
24
20
25
## Version 1.17.0/0.38b0 (2023-03-22)
21
26
Original file line number Diff line number Diff line change @@ -342,7 +342,9 @@ def _instrumented_lambda_handler_call( # noqa pylint: disable=too-many-branches
342
342
# If the request came from an API Gateway, extract http attributes from the event
343
343
# https://github.com/open-telemetry/opentelemetry-specification/blob/main/specification/trace/semantic_conventions/instrumentation/aws-lambda.md#api-gateway
344
344
# 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 (
346
+ "requestContext"
347
+ ):
346
348
span .set_attribute (SpanAttributes .FAAS_TRIGGER , "http" )
347
349
348
350
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):
399
399
},
400
400
)
401
401
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
+
402
411
def test_uninstrument (self ):
403
412
AwsLambdaInstrumentor ().instrument ()
404
413
You can’t perform that action at this time.
0 commit comments