Skip to main content
For the complete documentation index for agents and LLMs, see llms.txt.

OpenTelemetryConnector

Collect traces from your pipeline and send them to an OpenTelemetry backend. Use this component to trace operations and data flow within pipeline components.

Key Features

  • Sends pipeline traces to any OpenTelemetry-compatible backend.
  • No connections to other pipeline components required — add it to your pipeline and it traces all operations automatically.
  • Configurable component name to identify traces in your observability platform.
  • Supports tracing component inputs and outputs when content tracing is enabled.

Configuration

  1. Drag the OpenTelemetryConnector component onto the canvas from the Component Library.
  2. Click on the component to open the configuration panel.
  3. On the General tab, set name to identify this tracing component.
  4. Configure OpenTelemetry before the connector initializes:
    • Set HAYSTACK_CONTENT_TRACING_ENABLED to "true" to trace component inputs and outputs.
    • Configure an OpenTelemetry TracerProvider with an exporter (for example, OTLP) before adding the connector to your pipeline. A service name is required for most backends.

Connections

OpenTelemetryConnector doesn't connect to any other component. Add it to your pipeline without connecting it to other components. It outputs a name value that identifies the tracing component.

Source Code

To check this component's source code, open opentelemetry_connector.py in the Haystack Core Integrations repository.

Usage Examples

Basic Configuration

  OpenTelemetryConnector:
type: haystack_integrations.components.connectors.opentelemetry.opentelemetry_connector.OpenTelemetryConnector
init_parameters:
name: opentelemetry

Add OpenTelemetryConnector to your pipeline without connecting it to other components. It automatically traces all pipeline operations when tracing is enabled:

# haystack-pipeline
components:
prompt_builder:
type: haystack.components.builders.prompt_builder.PromptBuilder
init_parameters:
template: "Answer this question: {{ question }}"

llm:
type: haystack.components.generators.openai.OpenAIGenerator
init_parameters:
api_key: {"type": "env_var", "env_vars": ["OPENAI_API_KEY"], "strict": false}
model: gpt-4o

OpenTelemetryConnector:
type: haystack_integrations.components.connectors.opentelemetry.opentelemetry_connector.OpenTelemetryConnector
init_parameters:
name: rag-chat

connections:
- sender: prompt_builder.prompt
receiver: llm.prompt

inputs:
query:
- prompt_builder.question

outputs:
answers: llm.replies

Parameters

Inputs

This component takes no inputs.

Outputs

ParameterTypeDescription
namestrThe name of the tracing component.

Init Parameters

These are the parameters you can configure in Pipeline Builder:

ParameterTypeDefaultDescription
namestropentelemetryThe name used to identify this tracing component in your OpenTelemetry backend.

Run Method Parameters

This component has no run() method parameters.