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
48 changes: 48 additions & 0 deletions MIGRATION.md
Original file line number Diff line number Diff line change
Expand Up @@ -108,6 +108,54 @@ pip install <new-package>
| `from haystack.components.embedders.image import SentenceTransformersDocumentImageEmbedder` | `sentence-transformers-haystack` | `from haystack_integrations.components.embedders.sentence_transformers import SentenceTransformersDocumentImageEmbedder` |
| `from haystack.components.rankers import SentenceTransformersSimilarityRanker` | `sentence-transformers-haystack` | `from haystack_integrations.components.rankers.sentence_transformers import SentenceTransformersSimilarityRanker` |
| `from haystack.components.rankers import SentenceTransformersDiversityRanker` | `sentence-transformers-haystack` | `from haystack_integrations.components.rankers.sentence_transformers import SentenceTransformersDiversityRanker` |
| `from haystack.tracing.datadog import DatadogTracer` | `datadog-haystack` | `from haystack_integrations.tracing.datadog import DatadogTracer` |

### `DatadogTracer` moved to the `datadog-haystack` integration

**What changed:** The `DatadogTracer` has been moved out of Haystack into the `datadog-haystack` integration package.
In addition, Haystack no longer automatically enables Datadog tracing when `ddtrace` is installed. You now enable it
explicitly by adding the new `DatadogConnector` component to your pipeline.

**Why:** Moving the tracer to a dedicated package keeps Haystack's dependencies leaner and lets the integration be
released independently. Removing the implicit auto-enable makes tracing setup explicit and predictable.

**How to migrate:**

Install the integration:

```bash
pip install datadog-haystack
```

Before (v2.x), Datadog tracing was auto-enabled when `ddtrace` was installed, or set up manually:

```python
import ddtrace
from haystack import tracing
from haystack.tracing.datadog import DatadogTracer

tracing.enable_tracing(DatadogTracer(ddtrace.tracer))
```

After (v3.0), add the `DatadogConnector` to your pipeline to enable tracing:

```python
from haystack import Pipeline
from haystack_integrations.components.connectors.datadog import DatadogConnector

pipe = Pipeline()
pipe.add_component("tracer", DatadogConnector())
```

Alternatively, you can still enable the tracer manually using the new import path:

```python
import ddtrace
from haystack import tracing
from haystack_integrations.tracing.datadog import DatadogTracer

tracing.enable_tracing(DatadogTracer(ddtrace.tracer))
```

### `TransformersSimilarityRanker` removed

Expand Down
3 changes: 1 addition & 2 deletions docs-website/docs/development/tracing.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ Traces document the flow of requests through your application and are vital for

## Configuring a Tracing Backend

Instrumented applications typically send traces to a trace collector or a tracing backend. Haystack provides out-of-the-box support for [OpenTelemetry](https://opentelemetry.io/) and [Datadog](https://app.datadoghq.eu/dashboard/lists). You can also quickly implement support for additional providers of your choosing.
Instrumented applications typically send traces to a trace collector or a tracing backend. Haystack provides out-of-the-box support for [OpenTelemetry](https://opentelemetry.io/) and, through integrations, for backends such as [Datadog](https://www.datadoghq.com/), [Langfuse](https://langfuse.com/), and [MLflow](https://mlflow.org/). You can also quickly implement support for additional providers of your choosing.

### OpenTelemetry

Expand Down Expand Up @@ -202,7 +202,6 @@ To use your custom tracing backend with Haystack, follow these steps:
Haystack automatically detects and enables tracing under the following circumstances:

- If `opentelemetry-sdk` is installed and configured for OpenTelemetry.
- If `ddtrace` is installed for Datadog.

To disable this behavior, there are two options:

Expand Down
109 changes: 0 additions & 109 deletions haystack/tracing/datadog.py

This file was deleted.

17 changes: 1 addition & 16 deletions haystack/tracing/tracer.py
Original file line number Diff line number Diff line change
Expand Up @@ -198,7 +198,7 @@ def auto_enable_tracing() -> None:
if is_tracing_enabled():
return # tracing already enabled

tracer = _auto_configured_opentelemetry_tracer() or _auto_configured_datadog_tracer()
tracer = _auto_configured_opentelemetry_tracer()
if tracer:
enable_tracing(tracer)
logger.info("Auto-enabled tracing for '{tracer}'", tracer=tracer.__class__.__name__)
Expand Down Expand Up @@ -226,19 +226,4 @@ def _auto_configured_opentelemetry_tracer() -> Tracer | None:
return None


def _auto_configured_datadog_tracer() -> Tracer | None:
# we implement this here and not in the `datadog` module to avoid import warnings when Datadog is not installed
try:
from ddtrace.trace import tracer

from haystack.tracing.datadog import DatadogTracer

if tracer.enabled:
return DatadogTracer(tracer=tracer)
except ImportError:
pass

return None


auto_enable_tracing()
1 change: 0 additions & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -129,7 +129,6 @@ dependencies = [

# Tracing
"opentelemetry-sdk",
"ddtrace",

# Structured logging
"structlog",
Expand Down
36 changes: 36 additions & 0 deletions releasenotes/notes/remove-datadog-tracer-4f1c8a2b9d6e0a73.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
---
upgrade:
- |
The ``DatadogTracer`` has been moved out of Haystack into the ``datadog-haystack`` integration package.
It is no longer auto-enabled when ``ddtrace`` is installed; instead, use the new ``DatadogConnector`` component
to enable Datadog tracing in your pipeline. Install the new package with ``pip install datadog-haystack``.

Before:

.. code:: python

import ddtrace
from haystack import tracing
from haystack.tracing.datadog import DatadogTracer

tracing.enable_tracing(DatadogTracer(ddtrace.tracer))

After:

.. code:: python

from haystack import Pipeline
from haystack_integrations.components.connectors.datadog import DatadogConnector

pipe = Pipeline()
pipe.add_component("tracer", DatadogConnector())

Alternatively, you can still enable the tracer manually:

.. code:: python

import ddtrace
from haystack import tracing
from haystack_integrations.tracing.datadog import DatadogTracer

tracing.enable_tracing(DatadogTracer(ddtrace.tracer))
111 changes: 0 additions & 111 deletions test/tracing/test_datadog.py

This file was deleted.

Loading
Loading