Skip to content

Commit 6c3e619

Browse files
authored
Fix conflict with ddtrace futures patching by renaming fn parameter (#802)
1 parent 294aa41 commit 6c3e619

File tree

1 file changed

+6
-4
lines changed

1 file changed

+6
-4
lines changed

logfire/_internal/integrations/executors.py

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -28,15 +28,17 @@ def submit_t(s: ThreadPoolExecutor, fn: Callable[..., Any], /, *args: Any, **kwa
2828
"""A wrapper around ThreadPoolExecutor.submit() that carries over OTEL context across threads."""
2929
fn = partial(fn, *args, **kwargs)
3030
carrier = get_context()
31-
return submit_t_orig(s, _run_with_context, carrier=carrier, fn=fn, parent_config=None)
31+
return submit_t_orig(s, _run_with_context, carrier=carrier, func=fn, parent_config=None)
3232

3333
def submit_p(s: ProcessPoolExecutor, fn: Callable[..., Any], /, *args: Any, **kwargs: Any):
3434
"""A wrapper around ProcessPoolExecutor.submit() that carries over OTEL context across processes."""
3535
fn = partial(fn, *args, **kwargs)
3636
carrier = get_context()
37-
return submit_p_orig(s, _run_with_context, carrier=carrier, fn=fn, parent_config=serialize_config())
37+
return submit_p_orig(s, _run_with_context, carrier=carrier, func=fn, parent_config=serialize_config())
3838

39-
def _run_with_context(carrier: ContextCarrier, fn: Callable[[], Any], parent_config: dict[str, Any] | None) -> Any:
39+
def _run_with_context(
40+
carrier: ContextCarrier, func: Callable[[], Any], parent_config: dict[str, Any] | None
41+
) -> Any:
4042
"""A wrapper around a function that restores OTEL context from a carrier and then calls the function.
4143
4244
This gets run from within a process / thread.
@@ -45,7 +47,7 @@ def _run_with_context(carrier: ContextCarrier, fn: Callable[[], Any], parent_con
4547
deserialize_config(parent_config) # pragma: no cover
4648

4749
with attach_context(carrier):
48-
return fn()
50+
return func()
4951

5052
except ImportError: # pragma: no cover
5153

0 commit comments

Comments
 (0)