setup
Core OpenTelemetry tracing utilities and setup for Pipecat.
This module provides functions to check availability and configure OpenTelemetry tracing for Pipecat applications. It handles the optional nature of OpenTelemetry dependencies and provides a safe setup process.
- pipecat.utils.tracing.setup.is_tracing_available() bool[source]
Check if OpenTelemetry tracing is available and configured.
- Returns:
True if tracing is available, False otherwise.
- pipecat.utils.tracing.setup.setup_tracing(service_name: str = 'pipecat', exporter=None, console_export: bool = False) bool[source]
Set up OpenTelemetry tracing with a user-provided exporter.
- Parameters:
service_name – The name of the service for traces.
exporter – A pre-configured OpenTelemetry span exporter instance. If None, only console export will be available if enabled.
console_export – Whether to also export traces to console (useful for debugging).
- Returns:
True if setup was successful, False otherwise.
Example:
# With OTLP exporter from opentelemetry.exporter.otlp.proto.grpc.trace_exporter import OTLPSpanExporter exporter = OTLPSpanExporter(endpoint="http://localhost:4317", insecure=True) setup_tracing("my-service", exporter=exporter)