diff --git a/server/utilities/opentelemetry.mdx b/server/utilities/opentelemetry.mdx index 2779851..9943da6 100644 --- a/server/utilities/opentelemetry.mdx +++ b/server/utilities/opentelemetry.mdx @@ -151,6 +151,41 @@ exporter = OTLPSpanExporter( See our [Langfuse example](https://github.com/pipecat-ai/pipecat-examples/tree/main/open-telemetry/langfuse) for details on configuring this exporter. +### Opik (LLM observability) + +[Opik](https://www.comet.com/opik/) is an observability, evaluation, and optimization platform for LLM and agent workloads. Pipecat's span hierarchy maps directly onto Opik's trace explorer, allowing you to replay conversations, inspect service-level metrics, and monitor latency and cost for every turn. See our [Opik example](https://github.com/pipecat-ai/pipecat-examples/tree/main/open-telemetry/opik) for a reference implementation. + +1. Make sure the HTTP OTLP exporter is available (installed automatically with `pipecat-ai[tracing]`). +2. Configure your environment variables for the Opik deployment you use: + +```bash wordWrap +# Opik Cloud +export OTEL_EXPORTER_OTLP_ENDPOINT=https://www.comet.com/opik/api/v1/private/otel +export OTEL_EXPORTER_OTLP_HEADERS='Authorization=,Comet-Workspace=,projectName=' + +# Opik Enterprise +export OTEL_EXPORTER_OTLP_ENDPOINT=https:///opik/api/v1/private/otel +export OTEL_EXPORTER_OTLP_HEADERS='Authorization=,Comet-Workspace=,projectName=' + +# Self-hosted Opik +export OTEL_EXPORTER_OTLP_ENDPOINT=http://localhost:5173/api/v1/private/otel +export OTEL_EXPORTER_OTLP_HEADERS='projectName=' +``` + +3. Use the HTTP exporter without additional parameters—the headers and endpoint are picked up from the environment: + +```python +from opentelemetry.exporter.otlp.proto.http.trace_exporter import OTLPSpanExporter +from pipecat.utils.tracing.setup import setup_tracing + +setup_tracing( + service_name="pipecat-opik-demo", + exporter=OTLPSpanExporter(), +) +``` + +Opik automatically groups spans by `conversation_id`, enriches them with per-service metrics (LLM token usage, TTS character counts, STT transcripts, TTFB), and records any errors raised by your pipeline. Visit the [Pipecat + Opik guide](https://www.comet.com/docs/opik/tracing/integrations/pipecat) for screenshots and a full walkthrough. + ### Console Exporter (for debugging) The console exporter can be enabled alongside any other exporter by setting `console_export=True`: