Tracing
Traces document the flow of requests through your application and are vital for monitoring applications in production. This helps you understand the execution order of your pipeline components and analyze where your pipeline spends the most time.
Instrumented applications typically send traces to a trace collector or a tracing backend. Haystack provides out-of-the-box support for several backends, and you can also quickly implement support for additional providers of your choosing.
Supported Tracers
| Tracer | Description |
|---|---|
| OpenTelemetry | Send traces to any OpenTelemetry-compatible backend using the OpenTelemetryTracer or the OpenTelemetryConnector component. Includes a Jaeger setup for local development. |
| MLflow | Capture traces with MLflow's native Haystack tracing support. |
| Datadog | Trace your pipelines with Datadog using the DatadogTracer or the DatadogConnector component. |
| Langfuse | Trace your pipelines with the Langfuse UI using the LangfuseTracer or the LangfuseConnector component. |
| Weights & Biases Weave | Trace and visualize pipeline execution in Weights & Biases using the WeaveTracer or the WeaveConnector component. |
| LoggingTracer | Inspect the data flowing through your pipeline in real time through logs, with no backend setup. |
| Custom Tracer | Connect any tracing backend by implementing the Tracer interface. |
Disabling Auto Tracing
Haystack automatically detects and enables tracing under the following circumstances:
- If
opentelemetry-sdkis installed and configured for OpenTelemetry. Note that this auto-enabling is deprecated and will be removed in Haystack 3.0 – use theOpenTelemetryConnectorto enable OpenTelemetry tracing instead. - If
ddtraceis installed for Datadog. Note that this auto-enabling is deprecated and will be removed in Haystack 3.0 – use theDatadogConnectorto enable Datadog tracing instead.
To disable this behavior, there are two options:
- Set the environment variable
HAYSTACK_AUTO_TRACE_ENABLEDtofalsewhen running your Haystack application
— or —
-
Disable tracing in Python:
pythonfrom haystack.tracing import disable_tracingdisable_tracing()
Content Tracing
Haystack also allows you to trace your pipeline components' input and output values. This is useful for investigating your pipeline execution step by step.
By default, this behavior is disabled to prevent sensitive user information from being sent to your tracing backend.
To enable content tracing, there are two options:
- Set the environment variable
HAYSTACK_CONTENT_TRACING_ENABLEDtotruewhen running your Haystack application
— or —
-
Explicitly enable content tracing in Python:
pythonfrom haystack import tracingtracing.tracer.is_content_tracing_enabled = True