Adds Call Traces — per-turn STT/LLM/TTS latency for voice agent calls. - #123
Adds Call Traces — per-turn STT/LLM/TTS latency for voice agent calls.#123MSami625 wants to merge 59 commits into
Conversation
…3 artifacts on preview
…and actor stamping
…oved task dispatching
…ics across services
… for usage features
…tion in Docker and API
…rocess_evaluator_result.py
…ing and cache/Ui fixes
…r available models
…iguration for periodic job scheduling
…sage pricing routes; enhance usage snapshot billability checks
…eamline cost calculations for pending usage deltas
…ed references in the documentation
…ations; enforce CSP and adjust token lifetimes
… API keys; refactor local storage clearing logic
…orm logouts; streamline local storage clearing
…or evaluator results and metric studio runs; improve CSP policy for voice provider connections
…n events and audio billing; enhance CSP policy for frame sources
…API routes and services;
…g evaluator result creation and usage tracking;
…oducing patching for blob storage and integrating new storage stubs
…processing; improve error handling during database commits
…call usage tracking; update test to reflect new behavior
… tests; update configuration and service logic to prevent external API calls
… conversation tracking in test agents and voice agents
…and update configuration for Flexprice setup
…icense features to canonical meters with dry-run option
…ribe functionality and updating configuration options
…pt partial AI assistance, enhancing tracking for generated prompts and scenarios
…information and updating event handling for playground calls and fix sarvam ai flooding logs
…tes, enhancing telemetry capabilities
|
| Filename | Overview |
|---|---|
| app/services/voice_agent/playground_tracing.py | Adds in-process playground tracing but stores per-call correlation state in process-global mutable tracing components, allowing concurrent calls to be misattributed. |
| app/services/synthetic_traces/internal_otlp_exporter.py | Persists exported spans using mutable exporter-level tenant and call identifiers rather than immutable span-owned context. |
| app/api/v1/routes/synthetic_traces.py | Adds the trace API surface, but a workspace-scoped detail request invokes organization-wide trace backfilling. |
| app/services/synthetic_traces/trace_service.py | Implements correlation, persistence, backfill, and lifecycle handling; the backfill path lacks workspace scoping. |
| app/migrations/078_synthetic_call_traces.py | Adds trace, payload, and turn persistence structures with indexes for trace correlation and lookup. |
| frontend/src/components/call-recordings/SyntheticCallTracePanel.tsx | Adds the primary trace presentation panel for latency summaries, turns, charts, and waterfall details. |
| src/efficientai/integrations/efficientai_traces/setup.py | Adds SDK-side tracing setup and correlation support for external Pipecat agents. |
Reviews (1): Last reviewed commit: "feat(api): enhance Agent trace ingestion..." | Re-trigger Greptile
| provider = trace.get_tracer_provider() | ||
| if isinstance(provider, TracerProvider): | ||
| if _correlation_processor is None: | ||
| _correlation_processor = CorrelationSpanProcessor(attrs) | ||
| provider.add_span_processor(_correlation_processor) | ||
| else: | ||
| _correlation_processor.update_attributes(attrs) | ||
|
|
||
| _mutable_internal_exporter.configure( | ||
| organization_id=org_uuid, | ||
| workspace_id=ws_uuid, | ||
| call_short_id=call_short_id, | ||
| agent_id=agent_id, | ||
| ) |
There was a problem hiding this comment.
If playground voice calls overlap in one process, each call reconfigures the process-global span processor and exporter, so queued spans are persisted with the latest call's organization, workspace, and correlation identifiers, causing missing traces, incorrect latency data, or cross-tenant telemetry disclosure.
How this was verified: The shared exporter is mutated per call and reads its current tenant and call identifiers only when the asynchronous export executes.
Knowledge Base Used:
| backfill_missing_traces_from_call_recordings( | ||
| db, organization_id=organization_id, limit=5 | ||
| ) |
There was a problem hiding this comment.
What Changed?
Adds Call Traces — per-turn STT/LLM/TTS latency for voice agent calls.
/api/v1/observability/tracesAPI (session create, OTLP ingest, list/detail, close)078_synthetic_call_traces)efficientai.integrations.efficientai_traces) for external botsWhy?
Reviewers need per-turn latency (STT / LLM / TTS) during playground runs, phone evals, and external Pipecat agents. This adds OTLP-based trace ingest correlated by
call_short_id, so latency is visible in one place in the UI.How to Test?
eai start-alland confirm migration078applied.docs/synthetic-call-traces-pipecat.md→ talk 2–3 turns → check Call Traces UI.uv run pytest tests/test_synthetic_trace_*.py tests/test_efficientai_traces_correlation.py tests/test_services/test_playground_tracing.py -qRelease Label
Select one semantic version bump intent for this PR:
major- breaking change, next release bumps major versionminor- backward-compatible feature, next release bumps minor versionfix- backward-compatible bug fix, next release bumps patch versionIntended release label:
minorChecklist
CONTRIBUTING.mdguide.