Skip to content

Commit f8d6173

Browse files
committed
Extract xray context span id when it exists
1 parent f5812d5 commit f8d6173

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

datadog_lambda/tracing.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -89,7 +89,7 @@ def _convert_xray_sampling(xray_sampled):
8989
return SamplingPriority.USER_KEEP if xray_sampled else SamplingPriority.USER_REJECT
9090

9191

92-
def _get_xray_trace_context():
92+
def _get_xray_trace_context() -> Optional[Context]:
9393
if not is_lambda_context():
9494
return None
9595

@@ -604,7 +604,7 @@ def set_dd_trace_py_root(trace_context_source, merge_xray_traces):
604604
)
605605
if merge_xray_traces:
606606
xray_context = _get_xray_trace_context()
607-
if xray_context.span_id:
607+
if xray_context and xray_context.span_id:
608608
context.span_id = xray_context.span_id
609609

610610
tracer.context_provider.activate(context)

0 commit comments

Comments
 (0)