Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
35 changes: 35 additions & 0 deletions server/utilities/opentelemetry.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We're happy to add Opik, but to do so, you should first add an example to pipecat-examples:
https://github.com/pipecat-ai/pipecat-examples/tree/main/open-telemetry

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.


[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=<your-api-key>,Comet-Workspace=<workspace>,projectName=<project>'

# Opik Enterprise
export OTEL_EXPORTER_OTLP_ENDPOINT=https://<your-comet-domain>/opik/api/v1/private/otel
export OTEL_EXPORTER_OTLP_HEADERS='Authorization=<your-api-key>,Comet-Workspace=<workspace>,projectName=<project>'

# Self-hosted Opik
export OTEL_EXPORTER_OTLP_ENDPOINT=http://localhost:5173/api/v1/private/otel
export OTEL_EXPORTER_OTLP_HEADERS='projectName=<project>'
```

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`:
Expand Down