Skip to content

Fix parent source as being set as Xray, when trace merging disabled #60

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

Merged
merged 2 commits into from
May 14, 2020
Merged
Show file tree
Hide file tree
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 @@ -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
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Don't you need to change the signature where this method is called as well?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Whoops, good catch. Looks like I had a file I didn't stage into the commit. Should be updated

):
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