Skip to main content
Patter ships opt-in OpenTelemetry tracing that covers the four hot spots on the voice pipeline: STT, LLM, TTS, and tool calls. Every span carries the current getpatter.call.id so you can group by call in your backend.

Enable tracing

Tracing is disabled by default. Install the optional dependency and set the env flag:
pip install 'getpatter[tracing]'
export PATTER_OTEL_ENABLED=1
export OTEL_EXPORTER_OTLP_ENDPOINT=http://localhost:4318   # any OTLP/HTTP collector
Then call init_tracing once at process start — typically from the same module that creates your Patter client:
from getpatter.observability import init_tracing

init_tracing(
    service_name="my-voice-bot",
    otlp_endpoint="http://localhost:4318",
    resource_attributes={"deployment.environment": "staging"},
)
If PATTER_OTEL_ENABLED is not set, init_tracing returns False and every span becomes a no-op — zero cost when disabled.

Emitted spans

Span nameFiresAttributes
getpatter.sttOne per final transcriptgetpatter.stt.text_len, getpatter.stt.confidence
getpatter.llmOne per LLM iteration (incl. tool rounds)getpatter.llm.iteration, getpatter.llm.history_size
getpatter.ttsOne per synthesized sentencegetpatter.tts.text_len
getpatter.toolOne per tool invocationgetpatter.tool.name, getpatter.tool.transport

PII hygiene

Patter never exports user utterances, tool payloads, or LLM content as span attributes. Only sizes, counts, and identifiers are emitted — traces are safe to ship to a shared Jaeger / Honeycomb / Grafana Cloud instance.

Shutdown

Call shutdown_tracing() during graceful shutdown to flush any pending spans:
from getpatter.observability import shutdown_tracing

shutdown_tracing()

Troubleshooting

No spans appear → confirm PATTER_OTEL_ENABLED=1 is set in the process that calls init_tracing. Quick check:
from getpatter.observability import is_enabled
print(is_enabled())
Collector refuses spans → the endpoint defaults to OTLP/HTTP on port 4318. If you’re running the gRPC-only OTel Collector image, switch to otel/opentelemetry-collector-contrib or enable the HTTP receiver in your collector config.
Tracing is currently a Python-only feature. TypeScript parity is on the roadmap.