Skip to content

Commit 0463862

Browse files
more descriptive name
1 parent 81237b3 commit 0463862

File tree

1 file changed

+14
-14
lines changed

1 file changed

+14
-14
lines changed

datadog_lambda/tracing.py

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -233,7 +233,7 @@ def extract_context_from_sqs_or_sns_event_or_context(
233233
Falls back to lambda context if no trace data is found in the SQS message attributes.
234234
Set a DSM checkpoint if DSM is enabled and the method for context propagation is supported.
235235
"""
236-
arn = ""
236+
source_arn = ""
237237

238238
# EventBridge => SQS
239239
try:
@@ -245,7 +245,7 @@ def extract_context_from_sqs_or_sns_event_or_context(
245245

246246
try:
247247
first_record = event.get("Records")[0]
248-
arn = first_record.get("eventSourceARN", "")
248+
source_arn = first_record.get("eventSourceARN", "")
249249

250250
# logic to deal with SNS => SQS event
251251
if "body" in first_record:
@@ -297,12 +297,12 @@ def extract_context_from_sqs_or_sns_event_or_context(
297297
)
298298
context = propagator.extract(dd_data)
299299
# Do not want to set checkpoint with "" arn
300-
if arn:
300+
if source_arn:
301301
_dsm_set_checkpoint(
302302
dd_data,
303303
# In this function only recieves SQS and SNS events, if not SQS must be SNS
304304
"sqs" if event_source.equals(EventTypes.SQS) else "sns",
305-
arn,
305+
source_arn,
306306
)
307307
return context
308308
else:
@@ -330,20 +330,20 @@ def extract_context_from_sqs_or_sns_event_or_context(
330330
# Still want to set a DSM checkpoint even if DSM context not propagated
331331
# In this function only recieves SQS and SNS events, if not SQS must be SNS
332332
# Do not want to set checkpoint with "" arn
333-
if arn:
333+
if source_arn:
334334
_dsm_set_checkpoint(
335-
None, "sqs" if event_source.equals(EventTypes.SQS) else "sns", arn
335+
None, "sqs" if event_source.equals(EventTypes.SQS) else "sns", source_arn
336336
)
337337
return extract_context_from_lambda_context(lambda_context)
338338
except Exception as e:
339339
logger.debug("The trace extractor returned with error %s", e)
340340
# Still want to set a DSM checkpoint even if DSM context not propagated
341341
# Do not want to set checkpoint with "" arn
342-
if arn:
342+
if source_arn:
343343
_dsm_set_checkpoint(
344344
None,
345345
"sqs" if event_source.equals(EventTypes.SQS) else "sns",
346-
arn,
346+
source_arn,
347347
)
348348
return extract_context_from_lambda_context(lambda_context)
349349

@@ -405,10 +405,10 @@ def extract_context_from_kinesis_event(event, lambda_context):
405405
Extract datadog trace context from a Kinesis Stream's base64 encoded data string
406406
Set a DSM checkpoint if DSM is enabled and the method for context propagation is supported.
407407
"""
408-
arn = ""
408+
source_arn = ""
409409
try:
410410
record = get_first_record(event)
411-
arn = record.get("eventSourceARN", "")
411+
source_arn = record.get("eventSourceARN", "")
412412
kinesis = record.get("kinesis")
413413
if not kinesis:
414414
return extract_context_from_lambda_context(lambda_context)
@@ -424,15 +424,15 @@ def extract_context_from_kinesis_event(event, lambda_context):
424424
if dd_ctx:
425425
context = propagator.extract(dd_ctx)
426426
# Do not want to set checkpoint with "" arn
427-
if arn:
428-
_dsm_set_checkpoint(dd_ctx, "kinesis", arn)
427+
if source_arn:
428+
_dsm_set_checkpoint(dd_ctx, "kinesis", source_arn)
429429
return context
430430
except Exception as e:
431431
logger.debug("The trace extractor returned with error %s", e)
432432
# Still want to set a DSM checkpoint even if DSM context not propagated
433433
# Do not want to set checkpoint with "" arn
434-
if arn:
435-
_dsm_set_checkpoint(None, "kinesis", arn)
434+
if source_arn:
435+
_dsm_set_checkpoint(None, "kinesis", source_arn)
436436
return extract_context_from_lambda_context(lambda_context)
437437

438438

0 commit comments

Comments
 (0)