Skip to content

Commit f2b2dc3

Browse files
return early
1 parent 2067363 commit f2b2dc3

File tree

1 file changed

+3
-4
lines changed

1 file changed

+3
-4
lines changed

datadog_lambda/tracing.py

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -258,16 +258,15 @@ def extract_context_from_sqs_or_sns_event_or_context(
258258
try:
259259
dd_ctx = _extract_context_from_sqs_or_sns_record(record)
260260
if apm_context is None:
261-
if not dd_ctx:
262-
apm_context = _extract_context_from_xray(record)
263-
264-
elif dd_ctx and is_step_function_event(dd_ctx):
261+
if dd_ctx and is_step_function_event(dd_ctx):
265262
try:
266263
return extract_context_from_step_functions(dd_ctx, None)
267264
except Exception:
268265
logger.debug(
269266
"Failed to extract Step Functions context from SQS/SNS event."
270267
)
268+
elif not dd_ctx:
269+
apm_context = _extract_context_from_xray(record)
271270
else:
272271
apm_context = propagator.extract(dd_ctx)
273272
except Exception as e:

0 commit comments

Comments
 (0)