Summary
Add optional OpenTelemetry instrumentation to the Python SDK that automatically creates spans and records metrics for all Deepgram API calls — STT (REST + WebSocket), TTS (REST + WebSocket), Voice Agent sessions, and Audio Intelligence requests.
Problem it solves
Enterprise teams deploying Deepgram in production need distributed tracing and metrics to monitor performance, debug latency issues, and track usage across their application stack. Currently, developers must manually wrap every SDK call with OpenTelemetry instrumentation, which is error-prone, inconsistent, and misses internal SDK timing (WebSocket connection setup, audio chunking, response parsing). A built-in instrumentation layer provides consistent, zero-effort observability.
Proposed API
# Opt-in via instrumentor (standard OTEL pattern)
from deepgram.instrumentation.opentelemetry import DeepgramInstrumentor
DeepgramInstrumentor().instrument()
# All subsequent SDK calls automatically create spans and record metrics
client = DeepgramClient(api_key="...")
response = client.listen.rest.v("1").transcribe_file(payload, options)
# → Span: "deepgram.stt.rest" with attributes: model, language, duration_ms, audio_duration_s
# → Metrics: deepgram.stt.latency (histogram), deepgram.stt.requests (counter)
# WebSocket streaming sessions create parent span + child spans per result
async with client.listen.websocket.v("1").transcribe_stream(options) as ws:
# → Span: "deepgram.stt.websocket" (parent)
# → Metric: deepgram.stt.ttfb_ms (time to first result)
...
Metrics emitted:
deepgram.stt.latency_ms (histogram) — request duration
deepgram.stt.ttfb_ms (histogram) — time to first byte/result for streaming
deepgram.tts.latency_ms (histogram) — TTS request duration
deepgram.agent.session_duration_ms (histogram) — voice agent session length
deepgram.requests (counter) — total requests by API and status
deepgram.errors (counter) — errors by type
Acceptance criteria
Raised by the DX intelligence system.
Summary
Add optional OpenTelemetry instrumentation to the Python SDK that automatically creates spans and records metrics for all Deepgram API calls — STT (REST + WebSocket), TTS (REST + WebSocket), Voice Agent sessions, and Audio Intelligence requests.
Problem it solves
Enterprise teams deploying Deepgram in production need distributed tracing and metrics to monitor performance, debug latency issues, and track usage across their application stack. Currently, developers must manually wrap every SDK call with OpenTelemetry instrumentation, which is error-prone, inconsistent, and misses internal SDK timing (WebSocket connection setup, audio chunking, response parsing). A built-in instrumentation layer provides consistent, zero-effort observability.
Proposed API
Metrics emitted:
deepgram.stt.latency_ms(histogram) — request durationdeepgram.stt.ttfb_ms(histogram) — time to first byte/result for streamingdeepgram.tts.latency_ms(histogram) — TTS request durationdeepgram.agent.session_duration_ms(histogram) — voice agent session lengthdeepgram.requests(counter) — total requests by API and statusdeepgram.errors(counter) — errors by typeAcceptance criteria
pip install deepgram-sdk[opentelemetry]Raised by the DX intelligence system.