Skip to content

Commit ade45b9

Browse files
author
Emanuele Palazzetti
committed
[tornado] add a safe-guard in case a context is not available
1 parent 21facfd commit ade45b9

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

ddtrace/contrib/tornado/futures.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,8 +12,9 @@ def _wrap_submit(func, instance, args, kwargs):
1212
# TODO: the current implementation doesn't provide the GlobalTracer
1313
# singleton, so we should rely in our top-level import
1414
ctx = Context()
15-
current_ctx = tracer.get_call_context()
16-
ctx._current_span = current_ctx._current_span
15+
current_ctx = tracer.context_provider.active()
16+
if current_ctx is not None:
17+
ctx._current_span = current_ctx._current_span
1718

1819
# extract the target function that must be executed in
1920
# a new thread and the `target` arguments

0 commit comments

Comments
 (0)