service_decorators
Service-specific OpenTelemetry tracing decorators for Pipecat.
This module provides specialized decorators that automatically capture rich information about service execution including configuration, parameters, and performance metrics.
- pipecat.utils.tracing.service_decorators.traced_tts(func: Callable | None = None, *, name: str | None = None) Callable[source]
Trace TTS service methods with TTS-specific attributes.
Automatically captures and records:
Service name and model information
Voice ID and settings
Character count and text content
Performance metrics like TTFB
Works with both async functions and generators.
- Parameters:
func – The TTS method to trace.
name – Custom span name. Defaults to service type and class name.
- Returns:
Wrapped method with TTS-specific tracing.
- pipecat.utils.tracing.service_decorators.traced_stt(func: Callable | None = None, *, name: str | None = None) Callable[source]
Trace STT service methods with transcription attributes.
Automatically captures and records:
Service name and model information
Transcription text and final status
Language information
Performance metrics like TTFB
- Parameters:
func – The STT method to trace.
name – Custom span name. Defaults to function name.
- Returns:
Wrapped method with STT-specific tracing.
- pipecat.utils.tracing.service_decorators.traced_llm(func: Callable | None = None, *, name: str | None = None) Callable[source]
Trace LLM service methods with LLM-specific attributes.
Automatically captures and records:
Service name and model information
Context content and messages
Tool configurations
Token usage metrics
Performance metrics like TTFB
Aggregated output text
- Parameters:
func – The LLM method to trace.
name – Custom span name. Defaults to service type and class name.
- Returns:
Wrapped method with LLM-specific tracing.
- pipecat.utils.tracing.service_decorators.traced_gemini_live(operation: str) Callable[source]
Trace Gemini Live service methods with operation-specific attributes.
This decorator automatically captures relevant information based on the operation type:
llm_setup: Configuration, tools definitions, and system instructions
llm_tool_call: Function call information
llm_tool_result: Function execution results
llm_response: Complete LLM response with usage and output
- Parameters:
operation – The operation name (matches the event type being handled).
- Returns:
Wrapped method with Gemini Live specific tracing.
- pipecat.utils.tracing.service_decorators.traced_openai_realtime(operation: str) Callable[source]
Trace OpenAI Realtime service methods with operation-specific attributes.
This decorator automatically captures relevant information based on the operation type:
llm_setup: Session configuration and tools
llm_request: Context and input messages
llm_response: Usage metadata, output, and function calls
- Parameters:
operation – The operation name (matches the event type being handled).
- Returns:
Wrapped method with OpenAI Realtime specific tracing.