langfuse-haystack 4.0.0__tar.gz → 4.0.1__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {langfuse_haystack-4.0.0 → langfuse_haystack-4.0.1}/CHANGELOG.md +8 -0
- {langfuse_haystack-4.0.0 → langfuse_haystack-4.0.1}/PKG-INFO +1 -1
- {langfuse_haystack-4.0.0 → langfuse_haystack-4.0.1}/src/haystack_integrations/tracing/langfuse/tracer.py +5 -1
- {langfuse_haystack-4.0.0 → langfuse_haystack-4.0.1}/tests/test_tracer.py +39 -0
- {langfuse_haystack-4.0.0 → langfuse_haystack-4.0.1}/.gitignore +0 -0
- {langfuse_haystack-4.0.0 → langfuse_haystack-4.0.1}/LICENSE.txt +0 -0
- {langfuse_haystack-4.0.0 → langfuse_haystack-4.0.1}/README.md +0 -0
- {langfuse_haystack-4.0.0 → langfuse_haystack-4.0.1}/example/basic_rag.py +0 -0
- {langfuse_haystack-4.0.0 → langfuse_haystack-4.0.1}/example/chat.py +0 -0
- {langfuse_haystack-4.0.0 → langfuse_haystack-4.0.1}/example/requirements.txt +0 -0
- {langfuse_haystack-4.0.0 → langfuse_haystack-4.0.1}/pydoc/config_docusaurus.yml +0 -0
- {langfuse_haystack-4.0.0 → langfuse_haystack-4.0.1}/pyproject.toml +0 -0
- {langfuse_haystack-4.0.0 → langfuse_haystack-4.0.1}/src/haystack_integrations/components/connectors/__init__.py +0 -0
- {langfuse_haystack-4.0.0 → langfuse_haystack-4.0.1}/src/haystack_integrations/components/connectors/langfuse/__init__.py +0 -0
- {langfuse_haystack-4.0.0 → langfuse_haystack-4.0.1}/src/haystack_integrations/components/connectors/langfuse/langfuse_connector.py +0 -0
- {langfuse_haystack-4.0.0 → langfuse_haystack-4.0.1}/src/haystack_integrations/components/connectors/py.typed +0 -0
- {langfuse_haystack-4.0.0 → langfuse_haystack-4.0.1}/src/haystack_integrations/tracing/langfuse/__init__.py +0 -0
- {langfuse_haystack-4.0.0 → langfuse_haystack-4.0.1}/src/haystack_integrations/tracing/py.typed +0 -0
- {langfuse_haystack-4.0.0 → langfuse_haystack-4.0.1}/tests/__init__.py +0 -0
- {langfuse_haystack-4.0.0 → langfuse_haystack-4.0.1}/tests/test_langfuse_connector.py +0 -0
- {langfuse_haystack-4.0.0 → langfuse_haystack-4.0.1}/tests/test_tracing.py +0 -0
|
@@ -1,5 +1,13 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## [integrations/langfuse-v4.0.0] - 2026-01-12
|
|
4
|
+
|
|
5
|
+
### 🧹 Chores
|
|
6
|
+
|
|
7
|
+
- Make fmt command more forgiving (#2671)
|
|
8
|
+
- [**breaking**] Langfuse - drop Python 3.9 and use X|Y typing (#2709)
|
|
9
|
+
|
|
10
|
+
|
|
3
11
|
## [integrations/langfuse-v3.3.1] - 2025-12-10
|
|
4
12
|
|
|
5
13
|
### 🚀 Features
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: langfuse-haystack
|
|
3
|
-
Version: 4.0.
|
|
3
|
+
Version: 4.0.1
|
|
4
4
|
Summary: Langfuse integration for Haystack
|
|
5
5
|
Project-URL: Documentation, https://github.com/deepset-ai/haystack-core-integrations/tree/main/integrations/langfuse#readme
|
|
6
6
|
Project-URL: Issues, https://github.com/deepset-ai/haystack-core-integrations/issues
|
|
@@ -22,7 +22,7 @@ from haystack.tracing import utils as tracing_utils
|
|
|
22
22
|
|
|
23
23
|
import langfuse
|
|
24
24
|
from langfuse import LangfuseSpan as LangfuseClientSpan
|
|
25
|
-
from langfuse.types import TraceMetadata
|
|
25
|
+
from langfuse.types import TraceContext, TraceMetadata
|
|
26
26
|
|
|
27
27
|
logger = logging.getLogger(__name__)
|
|
28
28
|
|
|
@@ -287,8 +287,12 @@ class DefaultSpanHandler(SpanHandler):
|
|
|
287
287
|
root_span_type: Literal["agent", "span"] = (
|
|
288
288
|
"agent" if context.operation_name == "haystack.agent.run" else "span"
|
|
289
289
|
)
|
|
290
|
+
trace_context: TraceContext | None = cast(
|
|
291
|
+
TraceContext, {"trace_id": tracing_ctx.get("trace_id")} if tracing_ctx.get("trace_id") else None
|
|
292
|
+
)
|
|
290
293
|
# Create a new trace when there's no parent span
|
|
291
294
|
span_context_manager = self.tracer.start_as_current_observation(
|
|
295
|
+
trace_context=trace_context,
|
|
292
296
|
name=context.trace_name,
|
|
293
297
|
version=tracing_ctx.get("version"),
|
|
294
298
|
as_type=root_span_type,
|
|
@@ -18,6 +18,7 @@ from haystack_integrations.tracing.langfuse.tracer import (
|
|
|
18
18
|
LangfuseTracer,
|
|
19
19
|
SpanContext,
|
|
20
20
|
_sanitize_usage_data,
|
|
21
|
+
tracing_context_var,
|
|
21
22
|
)
|
|
22
23
|
|
|
23
24
|
|
|
@@ -222,6 +223,44 @@ class TestSanitizeUsageData:
|
|
|
222
223
|
|
|
223
224
|
|
|
224
225
|
class TestDefaultSpanHandler:
|
|
226
|
+
def test_create_span_root_trace(self):
|
|
227
|
+
"""Test creating a root span (no parent)."""
|
|
228
|
+
mock_client = Mock()
|
|
229
|
+
mock_client.start_as_current_span = Mock(return_value=MockContextManager())
|
|
230
|
+
mock_client.start_as_current_observation = Mock(return_value=MockContextManager())
|
|
231
|
+
|
|
232
|
+
handler = DefaultSpanHandler()
|
|
233
|
+
handler.init_tracer(mock_client)
|
|
234
|
+
|
|
235
|
+
context = MagicMock(spec=SpanContext)
|
|
236
|
+
context.parent_span = None
|
|
237
|
+
context.trace_name = "test_trace"
|
|
238
|
+
context.operation_name = "haystack.pipeline.run"
|
|
239
|
+
context.public = False
|
|
240
|
+
|
|
241
|
+
# Set up tracing context
|
|
242
|
+
token = tracing_context_var.set(
|
|
243
|
+
{"user_id": "test_user", "session_id": "test_session", "trace_id": "test_trace_id"}
|
|
244
|
+
)
|
|
245
|
+
try:
|
|
246
|
+
result = handler.create_span(context)
|
|
247
|
+
|
|
248
|
+
# Assert tracer was called with correct parameters
|
|
249
|
+
handler.tracer.start_as_current_observation.assert_called_once_with(
|
|
250
|
+
trace_context={"trace_id": "test_trace_id"},
|
|
251
|
+
name="test_trace",
|
|
252
|
+
version=None,
|
|
253
|
+
as_type="span",
|
|
254
|
+
)
|
|
255
|
+
call_kwargs = handler.tracer.start_as_current_observation.call_args[1]
|
|
256
|
+
assert "test_trace" == call_kwargs["name"]
|
|
257
|
+
assert "span" == call_kwargs["as_type"]
|
|
258
|
+
|
|
259
|
+
# Assert result is a LangfuseSpan
|
|
260
|
+
assert isinstance(result, LangfuseSpan)
|
|
261
|
+
finally:
|
|
262
|
+
tracing_context_var.reset(token)
|
|
263
|
+
|
|
225
264
|
def test_handle_generator(self):
|
|
226
265
|
mock_span = Mock()
|
|
227
266
|
mock_span.raw_span.return_value = mock_span
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{langfuse_haystack-4.0.0 → langfuse_haystack-4.0.1}/src/haystack_integrations/tracing/py.typed
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|