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:init_tracing once at process start — typically from the same module that creates your Patter client:
PATTER_OTEL_ENABLED is not set, init_tracing returns False and every span becomes a no-op — zero cost when disabled.
Emitted spans
All TS spans use the same
getpatter.* namespace as Python (the legacy patter.* names were normalised in 0.5.3 — both SDKs now emit identical span names so a single dashboard query works across runtimes).
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.Cost and latency attributes (patter.*)
Beyond the spans listed above, every billable hot path stamps patter.cost.* and patter.latency.* attributes on its span starting in 0.6.0. External aggregators (e.g. the patter-agent-runner acceptance suite) read these directly to compute per-call USD and latency without touching the SDK’s pricing table.
The two routing tags (
patter.call_id, patter.side) propagate via asyncio-safe ContextVars set at the top of the per-call WebSocket bridge, so all spans emitted under a call inherit them automatically — no manual wiring per span.
Attach a custom exporter (Patter._attach_span_exporter)
Embedding tools that observe Patter from the outside can wire their own exporter without touching PATTER_OTEL_ENABLED or init_tracing:
side is stamped on every cost/latency span this Patter instance emits during its call lifecycle. It exists to disambiguate two-Patter-instances-in-one-process layouts (e.g. driver vs unit-under-test in agent-to-agent acceptance tests). Default is "uut" if you only have one instance.
The leading underscore signals this is not part of the customer-facing API surface — it is a stable, public-but-underscore hook for tooling.
Shutdown
Callshutdown_tracing() during graceful shutdown to flush any pending spans:
Troubleshooting
No spans appear → confirmPATTER_OTEL_ENABLED=1 is set in the process that calls init_tracing. Quick check:
otel/opentelemetry-collector-contrib or enable the HTTP receiver in your collector config.
Tracing has full TypeScript parity since 0.5.3 — span names, attributes, and PII hygiene are identical. See TS Tracing.

