Skip to content

Commit

Permalink
fix: Improve TracingService initialization logic around deactivated (
Browse files Browse the repository at this point in the history
…#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>
  • Loading branch information
ogabrielluiz and autofix-ci[bot] authored Jan 21, 2025
1 parent 25bf7f9 commit c29e6ad
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion src/backend/base/langflow/services/tracing/service.py
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ async def log_worker(self) -> None:
self.logs_queue.task_done()

async def start(self) -> None:
if self.running or self.deactivated:
if self.running:
return
try:
self.running = True
Expand Down Expand Up @@ -112,8 +112,11 @@ def _reset_io(self) -> None:
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()
Expand Down

0 comments on commit c29e6ad

Please sign in to comment.