{"slug": "litellm-observability-monitoring-with-opentelemetry", "title": "LiteLLM Observability & Monitoring with OpenTelemetry", "summary": "SigNoz has released a guide for integrating LiteLLM observability with OpenTelemetry, enabling developers to capture traces, logs, and metrics from LiteLLM SDK and Proxy Server deployments. The integration provides real-time visibility into model performance, request/response details, latency, error rates, and usage trends through unified dashboards and alerts.", "body_md": "What is LiteLLM Observability?\n\nLiteLLM observability with [OpenTelemetry](https://opentelemetry.io/) gives you full visibility into your LiteLLM SDK and Proxy Server by capturing traces, logs, and metrics. This guide covers how to instrument LiteLLM and export telemetry data to SigNoz, enabling real-time visibility into model performance, request/response details, latency, error rates, and usage trends.\n\nWith full LiteLLM observability in SigNoz, you can correlate traces, logs, and metrics in unified dashboards and configure alerts for LiteLLM monitoring. This makes it easier to debug issues, optimize performance, and improve reliability across your AI workflows.\n\nPrerequisites\n\n- A\n[SigNoz Cloud account](https://signoz.io/teams/)with an active ingestion key - Internet access to send telemetry data to SigNoz Cloud\n[LiteLLM](https://www.litellm.ai/)SDK or Proxy integration- For Python:\n`pip`\n\ninstalled for managing Python packages and*(optional but recommended)*a Python virtual environment to isolate dependencies\n\nInstrumenting LiteLLM with OpenTelemetry\n\nLiteLLM can be monitored in two ways: using the **LiteLLM SDK** (directly embedded in your Python application code for programmatic LLM calls) or the **LiteLLM Proxy Server** (a standalone server that acts as a centralized gateway for managing and routing LLM requests across your infrastructure).\n\nFor more detailed info on instrumenting your LiteLLM SDK applications, see the [LiteLLM OpenTelemetry integration docs](https://docs.litellm.ai/docs/observability/opentelemetry_integration).\n\nNo-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.\n\n**Step 1:** Install the necessary packages in your Python environment.\n\n```\npip install \\\n  opentelemetry-api \\\n  opentelemetry-distro \\\n  opentelemetry-exporter-otlp \\\n  httpx \\\n  opentelemetry-instrumentation-httpx \\\n  litellm\n```\n\n**Step 2:** Add Automatic Instrumentation\n\n```\nopentelemetry-bootstrap --action=install\n```\n\n**Step 3:** Instrument your LiteLLM SDK application\n\nInitialize LiteLLM SDK instrumentation by calling `litellm.callbacks = [\"otel\"]`\n\n:\n\n``` python\nfrom litellm import litellm\n\nlitellm.callbacks = [\"otel\"]\n```\n\nThis call enables automatic tracing, logs, and metrics collection for all LiteLLM SDK calls in your application.\n\n📌 Note: Ensure this is called before any LiteLLM related calls to properly configure instrumentation of your application\n\n**Step 4:** Run an example\n\n``` python\nfrom litellm import completion, litellm\n\nlitellm.callbacks = [\"otel\"]\n\nresponse = completion(\n  model=\"openai/gpt-4o\",\n  messages=[{ \"content\": \"What is SigNoz\",\"role\": \"user\"}]\n)\n\nprint(response)\n```\n\n📌 Note: LiteLLM supports a\n\n[variety of model providers]for LLMs. In this example, we're using OpenAI. Before running this code, ensure that you have set the environment variable`OPENAI_API_KEY`\n\nwith your generated API key.\n\n**Step 5:** Run your application with auto-instrumentation\n\n```\nOTEL_RESOURCE_ATTRIBUTES=\"service.name=<service_name>\" \\\nOTEL_EXPORTER_OTLP_ENDPOINT=\"https://ingest.<region>.signoz.cloud:443\" \\\nOTEL_EXPORTER_OTLP_HEADERS=\"signoz-ingestion-key=<your-ingestion-key>\" \\\nOTEL_EXPORTER_OTLP_PROTOCOL=grpc \\\nOTEL_TRACES_EXPORTER=otlp \\\nOTEL_METRICS_EXPORTER=otlp \\\nOTEL_LOGS_EXPORTER=otlp \\\nOTEL_PYTHON_LOG_CORRELATION=true \\\nOTEL_PYTHON_LOGGING_AUTO_INSTRUMENTATION_ENABLED=true \\\nOTEL_PYTHON_DISABLED_INSTRUMENTATIONS=openai \\\nopentelemetry-instrument <your_run_command>\n```\n\n📌 Note: We're using\n\n`OTEL_PYTHON_DISABLED_INSTRUMENTATIONS=openai`\n\nin the run command to disable the OpenAI instrumentor for tracing. This avoids conflicts with LiteLLM's native telemetry/instrumentation, ensuring that telemetry is captured exclusively through LiteLLM's built-in instrumentation.\n\nis the name of your service`<service_name>`\n\n`<region>`\n\n: Your[SigNoz Cloud region](https://signoz.io/docs/ingestion/signoz-cloud/overview/#endpoint)`<your-ingestion-key>`\n\n: Your SigNoz[ingestion key](https://signoz.io/docs/ingestion/signoz-cloud/keys/)- Replace\n`<your_run_command>`\n\nwith the actual command you would use to run your application. For example:`python main.py`\n\nUsing self-hosted SigNoz? Most steps are identical. To adapt this guide, update the endpoint and remove the ingestion key header as shown in [Cloud → Self-Hosted](https://signoz.io/docs/ingestion/cloud-vs-self-hosted/#cloud-to-self-hosted).\n\nCode-based instrumentation gives you fine-grained control over your telemetry configuration. Use this approach when you need to customize resource attributes, sampling strategies, or integrate with existing observability infrastructure.\n\n**Step 1:** Install the necessary packages in your Python environment.\n\n```\npip install \\\n  opentelemetry-api \\\n  opentelemetry-sdk \\\n  opentelemetry-exporter-otlp \\\n  opentelemetry-instrumentation-httpx \\\n  opentelemetry-instrumentation-system-metrics \\\n  litellm\n```\n\n**Step 2:** Import the necessary modules in your Python application\n\n**Traces:**\n\n``` python\nfrom opentelemetry import trace\nfrom opentelemetry.sdk.resources import Resource\nfrom opentelemetry.sdk.trace import TracerProvider\nfrom opentelemetry.sdk.trace.export import BatchSpanProcessor\nfrom opentelemetry.exporter.otlp.proto.http.trace_exporter import OTLPSpanExporter\n```\n\n**Logs:**\n\n``` python\nfrom opentelemetry.sdk._logs import LoggerProvider, LoggingHandler\nfrom opentelemetry.sdk._logs.export import BatchLogRecordProcessor\nfrom opentelemetry.exporter.otlp.proto.http._log_exporter import OTLPLogExporter\nfrom opentelemetry._logs import set_logger_provider\nimport logging\n```\n\n**Metrics:**\n\n``` python\nfrom opentelemetry.sdk.metrics import MeterProvider\nfrom opentelemetry.exporter.otlp.proto.http.metric_exporter import OTLPMetricExporter\nfrom opentelemetry.sdk.metrics.export import PeriodicExportingMetricReader\nfrom opentelemetry import metrics\nfrom opentelemetry.instrumentation.system_metrics import SystemMetricsInstrumentor\nfrom opentelemetry.instrumentation.httpx import HTTPXClientInstrumentor\n```\n\n**Step 3:** Set up the OpenTelemetry Tracer Provider to send traces directly to SigNoz Cloud\n\n``` python\nfrom opentelemetry.sdk.resources import Resource\nfrom opentelemetry.sdk.trace import TracerProvider\nfrom opentelemetry.sdk.trace.export import BatchSpanProcessor\nfrom opentelemetry.exporter.otlp.proto.http.trace_exporter import OTLPSpanExporter\nfrom opentelemetry import trace\nimport os\n\nresource = Resource.create({\"service.name\": \"<service_name>\"})\nprovider = TracerProvider(resource=resource)\nspan_exporter = OTLPSpanExporter(\n    endpoint= os.getenv(\"OTEL_EXPORTER_TRACES_ENDPOINT\"),\n    headers={\"signoz-ingestion-key\": os.getenv(\"SIGNOZ_INGESTION_KEY\")},\n)\nprocessor = BatchSpanProcessor(span_exporter)\nprovider.add_span_processor(processor)\ntrace.set_tracer_provider(provider)\n```\n\nis the name of your service`<service_name>`\n\n→ SigNoz Cloud trace endpoint with appropriate`OTEL_EXPORTER_TRACES_ENDPOINT`\n\n[region](https://signoz.io/docs/ingestion/signoz-cloud/overview/#endpoint):`https://ingest.<region>.signoz.cloud:443/v1/traces`\n\n→ Your SigNoz`SIGNOZ_INGESTION_KEY`\n\n[ingestion key](https://signoz.io/docs/ingestion/signoz-cloud/keys/)\n\nUsing self-hosted SigNoz? Most steps are identical. To adapt this guide, update the endpoint and remove the ingestion key header as shown in [Cloud → Self-Hosted](https://signoz.io/docs/ingestion/cloud-vs-self-hosted/#cloud-to-self-hosted).\n\n**Step 4**: Setup Logs\n\n``` python\nimport logging\nfrom opentelemetry.sdk.resources import Resource\nfrom opentelemetry._logs import set_logger_provider\nfrom opentelemetry.sdk._logs import LoggerProvider, LoggingHandler\nfrom opentelemetry.sdk._logs.export import BatchLogRecordProcessor\nfrom opentelemetry.exporter.otlp.proto.http._log_exporter import OTLPLogExporter\nimport os\n\nresource = Resource.create({\"service.name\": \"<service_name>\"})\nlogger_provider = LoggerProvider(resource=resource)\nset_logger_provider(logger_provider)\n\notlp_log_exporter = OTLPLogExporter(\n    endpoint= os.getenv(\"OTEL_EXPORTER_LOGS_ENDPOINT\"),\n    headers={\"signoz-ingestion-key\": os.getenv(\"SIGNOZ_INGESTION_KEY\")},\n)\nlogger_provider.add_log_record_processor(\n    BatchLogRecordProcessor(otlp_log_exporter)\n)\n# Attach OTel logging handler to root logger\nhandler = LoggingHandler(level=logging.INFO, logger_provider=logger_provider)\nlogging.basicConfig(level=logging.INFO, handlers=[handler])\n\nlogger = logging.getLogger(__name__)\n```\n\nis the name of your service`<service_name>`\n\n→ SigNoz Cloud endpoint with appropriate`OTEL_EXPORTER_LOGS_ENDPOINT`\n\n[region](https://signoz.io/docs/ingestion/signoz-cloud/overview/#endpoint):`https://ingest.<region>.signoz.cloud:443/v1/logs`\n\n→ Your SigNoz`SIGNOZ_INGESTION_KEY`\n\n[ingestion key](https://signoz.io/docs/ingestion/signoz-cloud/keys/)\n\nUsing self-hosted SigNoz? Most steps are identical. To adapt this guide, update the endpoint and remove the ingestion key header as shown in [Cloud → Self-Hosted](https://signoz.io/docs/ingestion/cloud-vs-self-hosted/#cloud-to-self-hosted).\n\n**Step 5**: Setup Metrics\n\n``` python\nfrom opentelemetry.sdk.resources import Resource\nfrom opentelemetry.sdk.metrics import MeterProvider\nfrom opentelemetry.exporter.otlp.proto.http.metric_exporter import OTLPMetricExporter\nfrom opentelemetry.sdk.metrics.export import PeriodicExportingMetricReader\nfrom opentelemetry import metrics\nfrom opentelemetry.instrumentation.system_metrics import SystemMetricsInstrumentor\nimport os\n\nresource = Resource.create({\"service.name\": \"<service-name>\"})\nmetric_exporter = OTLPMetricExporter(\n    endpoint= os.getenv(\"OTEL_EXPORTER_METRICS_ENDPOINT\"),\n    headers={\"signoz-ingestion-key\": os.getenv(\"SIGNOZ_INGESTION_KEY\")},\n)\nreader = PeriodicExportingMetricReader(metric_exporter)\nmetric_provider = MeterProvider(metric_readers=[reader], resource=resource)\nmetrics.set_meter_provider(metric_provider)\n\nmeter = metrics.get_meter(__name__)\n\n# turn on out-of-the-box metrics\nSystemMetricsInstrumentor().instrument()\nHTTPXClientInstrumentor().instrument()\n```\n\nis the name of your service`<service_name>`\n\n→ SigNoz Cloud endpoint with appropriate`OTEL_EXPORTER_METRICS_ENDPOINT`\n\n[region](https://signoz.io/docs/ingestion/signoz-cloud/overview/#endpoint):`https://ingest.<region>.signoz.cloud:443/v1/metrics`\n\n→ Your SigNoz`SIGNOZ_INGESTION_KEY`\n\n[ingestion key](https://signoz.io/docs/ingestion/signoz-cloud/keys/)\n\nUsing self-hosted SigNoz? Most steps are identical. To adapt this guide, update the endpoint and remove the ingestion key header as shown in [Cloud → Self-Hosted](https://signoz.io/docs/ingestion/cloud-vs-self-hosted/#cloud-to-self-hosted).\n\n📌 Note: SystemMetricsInstrumentor provides system metrics (CPU, memory, etc.), and HTTPXClientInstrumentor provides outbound HTTP request metrics such as request duration. If you want to add custom metrics to your LiteLLM application, see\n\n[Python Custom Metrics].\n\n**Step 6:** Instrument your LiteLLM application\n\nInitialize LiteLLM SDK instrumentation by calling `litellm.callbacks = [\"otel\"]`\n\n:\n\n``` python\nfrom litellm import litellm\n\nlitellm.callbacks = [\"otel\"]\n```\n\nThis call enables automatic tracing, logs, and metrics collection for all LiteLLM SDK calls in your application.\n\n📌 Note: Ensure this is called before any LiteLLM related calls to properly configure instrumentation of your application\n\n**Step 7:** Run an example\n\n``` python\nfrom litellm import completion, litellm\n\nlitellm.callbacks = [\"otel\"]\n\nresponse = completion(\n  model=\"openai/gpt-4o\",\n  messages=[{ \"content\": \"What is SigNoz\",\"role\": \"user\"}]\n)\n\nprint(response)\n```\n\n📌 Note: LiteLLM supports a\n\n[variety of model providers]for LLMs. In this example, we're using OpenAI. Before running this code, ensure that you have set the environment variable`OPENAI_API_KEY`\n\nwith your generated API key.\n\nView LiteLLM Traces, Logs, and Metrics in SigNoz\n\nOnce configured, your LiteLLM application automatically emits traces, logs, and metrics.\n\nLiteLLM traces are available in SigNoz under the traces tab:\n\nWhen you click on a trace in SigNoz, you'll see a detailed view of the trace, including all associated spans, along with their events and attributes.\n\nLiteLLM logs are available in SigNoz under the logs tab. You can also view correlated logs by clicking the “Related Logs” button in the trace view:\n\nWhen you click on any of these logs in SigNoz, you'll see a detailed view of the log, including attributes:\n\nLiteLLM metrics are available in SigNoz under the metrics tab:\n\nWhen you click on any of these metrics in SigNoz, you'll see a detailed view of the metric, including attributes:\n\nLiteLLM SDK Observability Dashboard\n\nThe [LiteLLM SDK Dashboard](https://signoz.io/docs/dashboards/dashboard-templates/litellm-sdk-dashboard/) provides specialized visualizations for LiteLLM monitoring, including pre-built charts for LLM usage and import instructions to get started quickly.\n\n**Step 1:** Install the necessary packages in your Python environment.\n\n```\npip install opentelemetry-api \\\n  opentelemetry-sdk \\\n  opentelemetry-exporter-otlp \\\n  'litellm[proxy]'\n```\n\n**Step 2:** Configure otel for the LiteLLM Proxy Server\n\nAdd the following to `config.yaml`\n\n:\n\n```\nlitellm_settings:\n  callbacks: ['otel']\n```\n\n**Step 3:** Set the following environment variables:\n\n```\nexport OTEL_EXPORTER_OTLP_ENDPOINT=\"https://ingest.<region>.signoz.cloud:443\"\nexport OTEL_EXPORTER_OTLP_HEADERS=\"signoz-ingestion-key=<your-ingestion-key>\"\nexport OTEL_EXPORTER_OTLP_PROTOCOL=\"grpc\"\nexport OTEL_TRACES_EXPORTER=\"otlp\"\nexport OTEL_METRICS_EXPORTER=\"otlp\"\nexport OTEL_LOGS_EXPORTER=\"otlp\"\n```\n\n`<region>`\n\n: Your[SigNoz Cloud region](https://signoz.io/docs/ingestion/signoz-cloud/overview/#endpoint)`<your-ingestion-key>`\n\n: Your SigNoz[ingestion key](https://signoz.io/docs/ingestion/signoz-cloud/keys/)\n\nUsing self-hosted SigNoz? Most steps are identical. To adapt this guide, update the endpoint and remove the ingestion key header as shown in [Cloud → Self-Hosted](https://signoz.io/docs/ingestion/cloud-vs-self-hosted/#cloud-to-self-hosted).\n\n**Step 4:** Run the proxy server using the config file:\n\n```\nlitellm --config config.yaml\n```\n\nNow any calls made through your LiteLLM proxy server will be traced and sent to SigNoz.\n\nLiteLLM Proxy traces are available in SigNoz under the traces tab:\n\nWhen you click on a trace in SigNoz, you'll see a detailed view of the trace, including all associated spans, along with their events and attributes.\n\nLiteLLM Proxy Dashboard\n\nThe [LiteLLM Proxy Dashboard](https://signoz.io/docs/dashboards/dashboard-templates/litellm-proxy-dashboard/) provides specialized visualizations for LiteLLM Proxy monitoring, including pre-built charts for LLM usage and import instructions to get started quickly.", "url": "https://wpnews.pro/news/litellm-observability-monitoring-with-opentelemetry", "canonical_source": "https://signoz.io/docs/litellm-observability", "published_at": "2026-05-28 00:00:00+00:00", "updated_at": "2026-05-29 16:25:39.892451+00:00", "lang": "en", "topics": ["artificial-intelligence", "machine-learning", "large-language-models", "ai-tools", "mlops"], "entities": ["LiteLLM", "OpenTelemetry", "SigNoz", "Python"], "alternates": {"html": "https://wpnews.pro/news/litellm-observability-monitoring-with-opentelemetry", "markdown": "https://wpnews.pro/news/litellm-observability-monitoring-with-opentelemetry.md", "text": "https://wpnews.pro/news/litellm-observability-monitoring-with-opentelemetry.txt", "jsonld": "https://wpnews.pro/news/litellm-observability-monitoring-with-opentelemetry.jsonld"}}