VoiceLiveInstrumentor Class

Manages OpenTelemetry trace instrumentation for VoiceLive.

This class enables or disables tracing for the VoiceLive SDK. Instrumentation is opt-in and controlled via the AZURE_EXPERIMENTAL_ENABLE_GENAI_TRACING environment variable, which must be set to "true" for .instrument() to take effect.

Example usage:


   from azure.ai.voicelive.telemetry import VoiceLiveInstrumentor

   VoiceLiveInstrumentor().instrument()

Constructor

VoiceLiveInstrumentor()

Methods

instrument

Enable trace instrumentation for VoiceLive.

Tracing is gated behind the AZURE_EXPERIMENTAL_ENABLE_GENAI_TRACING environment variable. If it is not set to "true", this method is a no-op.

is_content_recording_enabled

Check whether message content recording is enabled.

is_instrumented

Check whether VoiceLive tracing is currently active.

uninstrument

Remove trace instrumentation for VoiceLive.

instrument

Enable trace instrumentation for VoiceLive.

Tracing is gated behind the AZURE_EXPERIMENTAL_ENABLE_GENAI_TRACING environment variable. If it is not set to "true", this method is a no-op.

instrument(enable_content_recording: bool | None = None) -> None

Parameters

Name Description
enable_content_recording
bool or None

Whether to record message content in spans. If None, the value is read from OTEL_INSTRUMENTATION_GENAI_CAPTURE_MESSAGE_CONTENT (preferred) or AZURE_TRACING_GEN_AI_CONTENT_RECORDING_ENABLED (legacy). Defaults to False if neither is set.

Default value: None

is_content_recording_enabled

Check whether message content recording is enabled.

is_content_recording_enabled() -> bool

Returns

Type Description

True if content recording is enabled.

is_instrumented

Check whether VoiceLive tracing is currently active.

is_instrumented() -> bool

Returns

Type Description

True if instrumentation is active.

uninstrument

Remove trace instrumentation for VoiceLive.

uninstrument() -> None