File tree Expand file tree Collapse file tree 1 file changed +4
-5
lines changed
Expand file tree Collapse file tree 1 file changed +4
-5
lines changed Original file line number Diff line number Diff line change @@ -49,7 +49,7 @@ async def main():
4949 "Cannot instrument. Please install 'taskiq[opentelemetry]'." ,
5050 ) from exc
5151
52-
52+ from opentelemetry . instrumentation . auto_instrumentation import initialize
5353from opentelemetry .instrumentation .instrumentor import ( # type: ignore[attr-defined]
5454 BaseInstrumentor ,
5555)
@@ -65,20 +65,19 @@ async def main():
6565logger = logging .getLogger ("taskiq.opentelemetry" )
6666
6767
68- def _worker_function_with_sitecustomize (
68+ def _worker_function_with_initialize (
6969 worker_function : Callable [[WorkerArgs ], None ],
7070 * args : Any ,
7171 ** kwargs : Any ,
7272) -> None :
73- import opentelemetry .instrumentation .auto_instrumentation .sitecustomize # noqa
74-
73+ initialize ()
7574 return worker_function (* args , ** kwargs )
7675
7776
7877def _worker_function_factory (
7978 worker_function : Callable [[WorkerArgs ], None ],
8079) -> Callable [[WorkerArgs ], None ]:
81- return partial (_worker_function_with_sitecustomize , worker_function )
80+ return partial (_worker_function_with_initialize , worker_function )
8281
8382
8483class TaskiqInstrumentor (BaseInstrumentor ):
You can’t perform that action at this time.
0 commit comments