Skip to content

Commit a837e6e

Browse files
committed
async fix
1 parent 76e30f0 commit a837e6e

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

ddtrace/contrib/internal/futures/threading.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -34,8 +34,9 @@ def _wrap_execution(ctx: Tuple[Optional[Context], Optional[Context]], fn, args,
3434
provider sets the Active context in a thread local storage
3535
variable because it's outside the asynchronous loop.
3636
"""
37-
if ctx[0] is not None:
38-
ddtrace.tracer.context_provider.activate(ctx[0])
3937
if ctx[1] is not None:
4038
core.dispatch("threading.execution", (ctx[1],))
39+
if ctx[0] is not None:
40+
with ddtrace.tracer._activate_context(ctx[0]):
41+
return fn(*args, **kwargs)
4142
return fn(*args, **kwargs)

0 commit comments

Comments
 (0)