Skip to content

Commit b9cbe01

Browse files
committed
push
1 parent db493c5 commit b9cbe01

2 files changed

Lines changed: 7 additions & 1 deletion

File tree

langfuse/_client/resource_manager.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -241,6 +241,10 @@ def _initialize_instance(
241241
f"media_threads={media_upload_thread_count or 1}"
242242
)
243243

244+
@classmethod
245+
def reset(cls):
246+
cls._instances.clear()
247+
244248
def add_score_task(self, event: dict):
245249
try:
246250
# Sample scores with the same sampler that is used for tracing

tests/test_otel.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,6 +57,7 @@ def cleanup_otel(self):
5757
original_provider = trace_api.get_tracer_provider()
5858
yield
5959
trace_api.set_tracer_provider(original_provider)
60+
LangfuseResourceManager.reset()
6061

6162
@pytest.fixture
6263
def memory_exporter(self):
@@ -875,6 +876,7 @@ def test_sampling(self, monkeypatch, tracer_provider, mock_processor_init):
875876
# Restore the original provider
876877
trace_api.set_tracer_provider(original_provider)
877878

879+
@pytest.mark.skip("Calling shutdown will pollute the global context")
878880
def test_shutdown_and_flush(self, langfuse_client, memory_exporter):
879881
"""Test shutdown and flush operations."""
880882
# Create a span without ending it
@@ -2375,7 +2377,7 @@ def mock_process_media(*, data, span, field):
23752377
span._process_media_in_attribute = original_process
23762378

23772379

2378-
class TestOtelIdGeneration:
2380+
class TestOtelIdGeneration(TestOTelBase):
23792381
"""Tests for trace_id and observation_id generation with and without seeds."""
23802382

23812383
@pytest.fixture

0 commit comments

Comments
 (0)