Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion langfuse/decorators/langfuse_decorator.py
Original file line number Diff line number Diff line change
Expand Up @@ -364,7 +364,9 @@ def _prepare_call(
# Create wrapper trace if generation is top-level
# Do not add wrapper trace to stack, as it does not have a corresponding end that will pop it off again
trace = self.client_instance.trace(
id=id, name=name, start_time=start_time
id=_root_trace_id_context.get() or id,
name=name,
start_time=start_time,
)
self._set_root_trace_id(trace.id)

Expand Down
6 changes: 4 additions & 2 deletions tests/test_singleton.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
import pytest
import threading
from unittest.mock import patch

import pytest

from langfuse.utils.langfuse_singleton import LangfuseSingleton


Expand Down Expand Up @@ -64,4 +66,4 @@ def test_reset_functionality(mock_langfuse):

assert instance._langfuse is None

mock_langfuse.return_value.flush.assert_called_once()
mock_langfuse.return_value.shutdown.assert_called_once()
Loading