Skip to content
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
2 changes: 2 additions & 0 deletions datadog_lambda/tracing.py
Original file line number Diff line number Diff line change
Expand Up @@ -699,6 +699,8 @@ def inject_correlation_ids():


def set_dd_trace_py_root(trace_context_source, merge_xray_traces):
if not _is_context_complete(dd_trace_context):
return
if trace_context_source == TraceContextSource.EVENT or merge_xray_traces:
context = Context(
trace_id=dd_trace_context.trace_id,
Expand Down
7 changes: 7 additions & 0 deletions tests/test_tracing.py
Original file line number Diff line number Diff line change
Expand Up @@ -934,6 +934,9 @@ def setUp(self):
self.mock_activate = patcher.start()
self.mock_activate.return_value = True
self.addCleanup(patcher.stop)
patcher = patch("datadog_lambda.tracing.dd_trace_context", None)
self.mock_dd_trace_context = patcher.start()
self.addCleanup(patcher.stop)

def tearDown(self):
global dd_tracing_enabled
Expand Down Expand Up @@ -991,6 +994,10 @@ def test_set_dd_trace_py_root_no_span_id(self):
self.mock_activate.assert_called()
self.mock_activate.assert_has_calls([call(expected_context)])

def test_set_dd_trace_py_root_none_context(self):
set_dd_trace_py_root(TraceContextSource.EVENT, True)
self.mock_activate.assert_not_called()
Copy link
Contributor

Choose a reason for hiding this comment

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

nit: this seems a to be a bit spookily-long-distance

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Sorry, I don't understand. The most important thing about this test is that it just doesn't raise an exception, which is what would happen before.

Copy link
Contributor

Choose a reason for hiding this comment

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

ah, i see! could we add a check that confirms that it is in fact none? or something?



class TestServiceMapping(unittest.TestCase):
def setUp(self):
Expand Down
Loading