Skip to content

Commit 10e6421

Browse files
author
Emanuele Palazzetti
committed
[tornado] propagate all Context attributes
1 parent 98202f9 commit 10e6421

File tree

2 files changed

+11
-1
lines changed

2 files changed

+11
-1
lines changed

ddtrace/context.py

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,12 @@ def span_id(self):
5151
with self._lock:
5252
return self._parent_span_id
5353

54+
@property
55+
def sampled(self):
56+
"""Return current context sampled flag."""
57+
with self._lock:
58+
return self._sampled
59+
5460
@property
5561
def sampling_priority(self):
5662
"""Return current context sampling priority."""

ddtrace/contrib/tornado/futures.py

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,11 @@ def _wrap_submit(func, instance, args, kwargs):
1414
ctx = Context()
1515
current_ctx = tracer.context_provider.active()
1616
if current_ctx is not None:
17-
ctx._current_span = current_ctx._current_span
17+
ctx._current_span = current_ctx.get_current_span()
18+
ctx._parent_trace_id = current_ctx.trace_id
19+
ctx._parent_span_id = current_ctx.span_id
20+
ctx._sampled = current_ctx.sampled
21+
ctx._sampling_priority = current_ctx.sampling_priority
1822

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

0 commit comments

Comments
 (0)