chilly-ghost-74326
08/01/2025, 4:18 PMtall-airline-16756
08/01/2025, 4:18 PMtall-airline-16756
08/01/2025, 4:18 PMchilly-ghost-74326
08/01/2025, 4:19 PMtall-airline-16756
08/01/2025, 4:20 PMchilly-ghost-74326
08/01/2025, 4:21 PMtall-airline-16756
08/01/2025, 4:22 PMchilly-ghost-74326
08/01/2025, 4:23 PMtall-airline-16756
08/01/2025, 4:23 PMpublisherRtt, subscriberRtt, and ttfb (Time To First Byte) to keep an eye on.
2. Use the MetricsCollector: You can use the MetricsCollector class to track latency metrics easily. For example: from livekit.agents.metrics import MetricsCollector
metrics = MetricsCollector()
metrics.record_latency("llm_response_time", response_time_ms)
3. Turn On Telemetry: Make sure telemetry is enabled in your LiveKit setup so all those useful metrics get captured and sent your way.
4. Check Out Metrics with Prometheus: You can query latency metrics using Prometheus like this: prometheus_record_latency_seconds_bucket{label="subscriberRtt"}
5. Dig Into the Data: Use what you’ve collected to monitor how things are running and find ways to make your app even better.
Following these steps will make it a breeze to expose and keep track of latency metrics in your LiveKit app. If you have any questions, I’m here to help!
Sources: Sources/LiveKit/Protos/livekit_metrics.pb.swift | livekit/livekit_internal.pb.go | Agent Testing & Evaluation | livekit/livekit_composite | DeepWiki | pkg/sfu/forwardstats.gochilly-ghost-74326
08/01/2025, 4:57 PMtall-airline-16756
08/01/2025, 4:57 PMchilly-ghost-74326
08/01/2025, 5:00 PMtall-airline-16756
08/01/2025, 5:00 PMchilly-ghost-74326
08/01/2025, 5:00 PM