ServiceDecorators

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=None, *, name=None)[source]

Traces 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 (Callable | None) – The TTS method to trace.

  • name (str | None) – Custom span name. Defaults to service type and class name.

Returns:

Wrapped method with TTS-specific tracing.

Return type:

Callable

pipecat.utils.tracing.service_decorators.traced_stt(func=None, *, name=None)[source]

Traces 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 (Callable | None) – The STT method to trace.

  • name (str | None) – Custom span name. Defaults to function name.

Returns:

Wrapped method with STT-specific tracing.

Return type:

Callable

pipecat.utils.tracing.service_decorators.traced_llm(func=None, *, name=None)[source]

Traces 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 (Callable | None) – The LLM method to trace.

  • name (str | None) – Custom span name. Defaults to service type and class name.

Returns:

Wrapped method with LLM-specific tracing.

Return type:

Callable

pipecat.utils.tracing.service_decorators.traced_gemini_live(operation)[source]

Traces 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 (str) – The operation name (matches the event type being handled)

Returns:

Wrapped method with Gemini Live specific tracing.

Return type:

Callable

pipecat.utils.tracing.service_decorators.traced_openai_realtime(operation)[source]

Traces 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 (str) – The operation name (matches the event type being handled)

Returns:

Wrapped method with OpenAI Realtime specific tracing.

Return type:

Callable