Skip to content

Use xray context span id when it exists #400

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 1 commit into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions datadog_lambda/tracing.py
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ def _convert_xray_sampling(xray_sampled):
return SamplingPriority.USER_KEEP if xray_sampled else SamplingPriority.USER_REJECT


def _get_xray_trace_context():
def _get_xray_trace_context() -> Optional[Context]:
if not is_lambda_context():
return None

Expand Down Expand Up @@ -604,7 +604,7 @@ def set_dd_trace_py_root(trace_context_source, merge_xray_traces):
)
if merge_xray_traces:
xray_context = _get_xray_trace_context()
if xray_context.span_id:
if xray_context and xray_context.span_id:
context.span_id = xray_context.span_id

tracer.context_provider.activate(context)
Expand Down