how to get metric on end to end latency
# ask-ai
g
how to get metric on end to end latency
t
Thanks for reaching out, Andrii. I'm an AI assistant and I'm here to help. Give me a moment while I research this topic.
Measuring end-to-end latency in LiveKit can feel a bit tricky, but I’m here to help you through it! You can calculate it using this simple formula:
total_latency = eou.end_of_utterance_delay + llm.ttft + tts.ttfb
Let me explain what each part means: • eou.end_of_utterance_delay: This is the time from when the voice activity stops until the LLM starts processing. • llm.ttft: The time the LLM takes to generate the very first token of its response. • tts.ttfb: The time the TTS system takes to produce the first audio byte. To gather these numbers, you’ll want to subscribe to the
metrics_collected
event during your session and capture the relevant metrics (
EOUMetrics
,
LLMMetrics
,
TTSMetrics
). Once you have all these, you can easily compute the total latency. If you’d like, I’m more than happy to share some code examples or dive deeper into any part of this—just let me know!