Skip to content

Commit

Permalink
Merge pull request #60 from DataDog/darcy.rayner/fix-tracing-edge-case
Browse files Browse the repository at this point in the history
Fix parent source as being set as Xray, when trace merging disabled
  • Loading branch information
DarcyRaynerDD authored May 14, 2020
2 parents 510f1d0 + 6018352 commit 9999a37
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 3 deletions.
4 changes: 2 additions & 2 deletions datadog_lambda/tracing.py
Original file line number Diff line number Diff line change
Expand Up @@ -234,7 +234,7 @@ def set_dd_trace_py_root(trace_context, merge_xray_traces):


def create_function_execution_span(
context, function_name, is_cold_start, trace_context
context, function_name, is_cold_start, trace_context, merge_xray_traces
):
tags = {}
if context:
Expand All @@ -246,7 +246,7 @@ def create_function_execution_span(
"resource_names": context.function_name,
}
source = trace_context["source"]
if source != TraceContextSource.DDTRACE:
if source == TraceContextSource.XRAY and merge_xray_traces:
tags["_dd.parent_source"] = source

args = {
Expand Down
6 changes: 5 additions & 1 deletion datadog_lambda/wrapper.py
Original file line number Diff line number Diff line change
Expand Up @@ -122,7 +122,11 @@ def _before(self, event, context):
if dd_tracing_enabled:
set_dd_trace_py_root(dd_context, self.merge_xray_traces)
self.span = create_function_execution_span(
context, self.function_name, is_cold_start(), dd_context
context,
self.function_name,
is_cold_start(),
dd_context,
self.merge_xray_traces,
)
else:
set_correlation_ids()
Expand Down

0 comments on commit 9999a37

Please sign in to comment.