Skip to content

Commit 6bf1e29

Browse files
ref(aws-lambda): Simplify reading Records for producer links
1 parent 578e4ef commit 6bf1e29

1 file changed

Lines changed: 5 additions & 2 deletions

File tree

‎sentry_sdk/integrations/aws_lambda/_handler.py‎

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -46,9 +46,12 @@
4646

4747
def _get_producer_links(aws_event: "Any") -> "list[SpanLink]":
4848
"""Links to the spans that sent the SQS or SNS messages this invocation got."""
49-
records = aws_event.get("Records") if isinstance(aws_event, dict) else None
49+
records: "list[Any]" = []
50+
if isinstance(aws_event, dict):
51+
records = aws_event.get("Records") or []
52+
5053
links: "list[SpanLink]" = []
51-
for record in records or ():
54+
for record in records:
5255
if "Sns" in record:
5356
# https://docs.aws.amazon.com/lambda/latest/dg/with-sns.html
5457
sentry_trace = (

0 commit comments

Comments
 (0)