We notice subscription time and publish time metri...
# ask-ai
c
We notice subscription time and publish time metrics spikes a lot going upto 3-5 seconds , can you help with steps to debug this. One thing I noticed is for subscription when it takes long time, remote description answer is received after a long delay after the offer is sent
t
Thanks for reaching out, Yash. I'm an AI assistant and I'm here to help. Give me a moment while I research this topic.
To debug subscription and publish time metric spikes in LiveKit, you can follow these steps: • Monitor metrics for publish and subscribe times using the available functions like
RecordPublishTime
and
RecordSubscribeTime
. These track attempts, success rates, and failures. • Check for jitter buffer delays and quality limitation durations caused by bandwidth or CPU constraints. • Use client-side monitoring tools such as the MetricsManager in the Swift SDK or the
collectMetrics()
function in the Android SDK to gather detailed metrics. • Analyze RTT (Round Trip Time) metrics, including Publisher RTT, Server Mesh RTT, and Subscriber RTT, to identify network-related delays. Since you mentioned delays in receiving the remote description answer, it might be helpful to investigate network conditions, signaling server performance, and any potential bottlenecks in the signaling process. Let me know if you need further assistance with any specific step or tool. Sources: Sources/LiveKit/Protos/livekit_metrics.pb.swift | pkg/sfu/utils/owd_estimator.go | livekit-android-sdk/src/main/java/io/livekit/android/room/metrics/RTCMetric... | protobufs/livekit_metrics.proto
c
how to track RTT metrics
t
Hey there! If you want to keep an eye on RTT (Round Trip Time) metrics in LiveKit, the SDK has a handy RTT interceptor just for that. Here’s a simple way to set it up: 1. First, create an RTT interceptor using the
NewRTTInterceptorFactory
function. You’ll provide a callback to handle RTT updates like this:
Copy code
interceptorFactory := interceptor.NewRTTInterceptorFactory(func(rtt uint32) {
    // Here’s where you can work with the RTT value
    log.Printf("Current RTT: %d ms", rtt)
})
1. Next, add the interceptor to your LiveKit transport to start tracking RTT:
Copy code
transport.AddInterceptor(interceptorFactory)
This RTT interceptor listens for RTCP packets and figures out RTT using info from
ReceiverReport
blocks. Every time the RTT updates, your callback will be called, so you can log it or dig into the data. If you want me to walk you through any part of this or have questions, just let me know—I’m here to help!