Skip to content

feat(metrics): add playback_start_latency metric#5524

Open
longcw wants to merge 5 commits intomainfrom
longc/audio-forwarding-metrics
Open

feat(metrics): add playback_start_latency metric#5524
longcw wants to merge 5 commits intomainfrom
longc/audio-forwarding-metrics

Conversation

@longcw
Copy link
Copy Markdown
Contributor

@longcw longcw commented Apr 22, 2026

Summary

Adds a new playback_start_latency metric on assistant ChatMessages, measuring the time between the first audio frame being forwarded and playback actually starting.

This metric is typically near-zero in normal pipelines, and becomes significant when a remote avatar worker is in the chain. Requires playback_started RPC call from the avatar to measure this latency #5511

@chenghao-mou chenghao-mou requested a review from a team April 22, 2026 08:47
Copy link
Copy Markdown
Contributor

@devin-ai-integration devin-ai-integration Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

✅ Devin Review: No Issues Found

Devin Review analyzed this PR and found no potential bugs to report.

View in Devin Review to see 3 additional findings.

Open in Devin Review

Typically very small; can be significant when a remote avatar worker is in the chain.

Assistant `ChatMessage` only
"""
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Makes sense! Is it included inside the e2e_latency?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yes, it's included inside the e2e_latency

Comment thread livekit-agents/livekit/agents/llm/chat_context.py Outdated
"""

playback_start_latency: float
"""Latency between the first audio frame being forwarded and playback starting on the client.
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Latency between the first audio frame being forwarded and playback starting on the client

It isn't really accurate tho? We don't know when the client is playing the audio (+ network latency?)
It's true for avatars. But we should maybe clarify

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yeah, it didn't include the network latency, updated the docstring.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants