From c29e6ad3d56fa9888aaaba53214320d5782b9705 Mon Sep 17 00:00:00 2001 From: Gabriel Luiz Freitas Almeida Date: Tue, 21 Jan 2025 17:38:29 -0300 Subject: [PATCH] fix: Improve TracingService initialization logic around `deactivated` (#5847) * fix: improve TracingService initialization logic - Updated the `start` method to remove the check for `self.deactivated`, allowing the service to start even if deactivated. - Added a check in `initialize_tracers` to return early if the service is deactivated, preventing unnecessary initialization calls. These changes streamline the service's startup process and ensure that tracer initialization respects the deactivated state. * [autofix.ci] apply automated fixes * [autofix.ci] apply automated fixes (attempt 2/3) * [autofix.ci] apply automated fixes (attempt 3/3) --------- Co-authored-by: autofix-ci[bot] <114827586+autofix-ci[bot]@users.noreply.github.com> --- src/backend/base/langflow/services/tracing/service.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/backend/base/langflow/services/tracing/service.py b/src/backend/base/langflow/services/tracing/service.py index e4a055269..4742fb0ed 100644 --- a/src/backend/base/langflow/services/tracing/service.py +++ b/src/backend/base/langflow/services/tracing/service.py @@ -77,7 +77,7 @@ class TracingService(Service): self.logs_queue.task_done() async def start(self) -> None: - if self.running or self.deactivated: + if self.running: return try: self.running = True @@ -112,8 +112,11 @@ class TracingService(Service): self.outputs_metadata = defaultdict(dict) async def initialize_tracers(self) -> None: + if self.deactivated: + return try: await self.start() + self._initialize_langsmith_tracer() self._initialize_langwatch_tracer() self._initialize_langfuse_tracer()