From aee5d11d59e92be0604b2344fc8a1621d6190f94 Mon Sep 17 00:00:00 2001 From: Federico Busetti <729029+febus982@users.noreply.github.com> Date: Wed, 5 Feb 2025 22:43:33 +0000 Subject: [PATCH] Do not instrument multiple times dramatiq --- src/common/dramatiq.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/common/dramatiq.py b/src/common/dramatiq.py index 5c41054..ad87b6a 100644 --- a/src/common/dramatiq.py +++ b/src/common/dramatiq.py @@ -28,7 +28,9 @@ def decode(self, data: bytes) -> MessageData: def init_dramatiq(config: AppConfig): broker: Broker - DramatiqInstrumentor().instrument() + dramatiq_instrumentor = DramatiqInstrumentor() + if not dramatiq_instrumentor.is_instrumented_by_opentelemetry: + dramatiq_instrumentor.instrument() if config.DRAMATIQ.REDIS_URL is not None: broker = RedisBroker(url=config.DRAMATIQ.REDIS_URL)