Haystack Observability & Monitoring with OpenTelemetry Haystack users can now monitor their AI applications with OpenTelemetry by exporting traces, logs, and metrics to SigNoz for unified observability dashboards and alerting. The integration requires a SigNoz Cloud account or self-hosted instance, Python 3.10+, and an OpenAI API key, with auto-instrumentation enabling quick setup through environment variable configuration. This allows developers to track LLM usage and application performance across AI workflows to improve reliability and user experience. Overview This guide walks you through setting up observability and monitoring for Haystack using OpenTelemetry https://opentelemetry.io/ and exporting traces, logs, and metrics to SigNoz. With this integration, you can observe and track various metrics for your Haystack applications and llm usage. Monitoring Haystack in your AI applications with telemetry ensures full observability across your AI and LLM workflows. By leveraging SigNoz, you can analyze correlated traces, logs, and metrics in unified dashboards, configure alerts, and gain actionable insights to continuously improve reliability, responsiveness, and user experience. Prerequisites - A SigNoz Cloud account https://signoz.io/teams/ with an active ingestion key or Self Hosted SigNoz instance https://signoz.io/docs/install/self-host/ - Internet access to send telemetry data to SigNoz Cloud - Python 3.10+ with haystack-ai installed - For Python: pip installed for managing Python packages - A OpenAI API key. You can get it from OpenAI platform https://platform.openai.com/settings/organization/api-keys Monitoring Haystack For more information on getting started with Haystack in your Python environment, refer to the Haystack quickstart guide https://haystack.deepset.ai/overview/quick-start . No code auto-instrumentation is recommended for quick setup with minimal code changes. It's ideal when you want to get observability up and running without modifying your application code and are leveraging standard instrumentor libraries. Step 1: Install the necessary packages in your Python environment. pip install \ opentelemetry-distro \ opentelemetry-exporter-otlp \ httpx \ opentelemetry-instrumentation-httpx \ opentelemetry-instrumentation-system-metrics \ haystack-ai \ openinference-instrumentation-haystack Step 2: Add Automatic Instrumentation opentelemetry-bootstrap --action=install Step 3: Configure logging level To ensure logs are properly captured and exported, configure the root logger to emit logs at the DEBUG level or higher: python import logging logging.getLogger .setLevel logging.DEBUG logging.getLogger "httpx" .setLevel logging.DEBUG This sets the minimum log level for the root logger to DEBUG, which ensures that logger.debug calls and higher severity logs INFO, WARNING, ERROR, CRITICAL are captured by the OpenTelemetry logging auto-instrumentation and sent to SigNoz. Step 4: Create an example Haystack application python from haystack.components.agents import Agent from haystack.components.generators.chat import OpenAIChatGenerator from haystack.dataclasses import ChatMessage agent = Agent chat generator=OpenAIChatGenerator model='gpt-4o-mini' , system prompt="You are a helpful assistant.", result = agent.run messages= ChatMessage.from user "What is SigNoz?" print result 'last message' .text Before running this code, ensure that you have set the environment variable OPENAI API KEY with your generated OpenAI API key. Step 5: Run your application with auto-instrumentation Run your application with the following environment variables set. This configures OpenTelemetry to export traces, logs, and metrics to SigNoz Cloud and enables automatic log correlation: OTEL RESOURCE ATTRIBUTES="service.name=