add log for unexpected jitter (#2752)
This commit is contained in:
+12
-2
@@ -1,11 +1,13 @@
|
|||||||
package sfu
|
package sfu
|
||||||
|
|
||||||
import (
|
import (
|
||||||
|
"fmt"
|
||||||
"sync"
|
"sync"
|
||||||
"sync/atomic"
|
"sync/atomic"
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
"github.com/livekit/livekit-server/pkg/telemetry/prometheus"
|
"github.com/livekit/livekit-server/pkg/telemetry/prometheus"
|
||||||
|
"github.com/livekit/protocol/logger"
|
||||||
"github.com/livekit/protocol/utils"
|
"github.com/livekit/protocol/utils"
|
||||||
)
|
)
|
||||||
|
|
||||||
@@ -46,9 +48,17 @@ func (s *ForwardStats) Update(arrival, left time.Time) {
|
|||||||
|
|
||||||
func (s *ForwardStats) GetStats() (latency, jitter time.Duration) {
|
func (s *ForwardStats) GetStats() (latency, jitter time.Duration) {
|
||||||
s.lock.Lock()
|
s.lock.Lock()
|
||||||
defer s.lock.Unlock()
|
|
||||||
w := s.latency.Summarize()
|
w := s.latency.Summarize()
|
||||||
return time.Duration(w.Mean()), time.Duration(w.StdDev())
|
s.lock.Unlock()
|
||||||
|
latency, jitter = time.Duration(w.Mean()), time.Duration(w.StdDev())
|
||||||
|
// TODO: remove this check after debugging unexpected jitter issue
|
||||||
|
if jitter > 10*time.Second {
|
||||||
|
logger.Infow("unexpected forward jitter",
|
||||||
|
"jitter", jitter,
|
||||||
|
"stats", fmt.Sprintf("count %.2f, mean %.2f, stdDev %.2f", w.Count(), w.Mean(), w.StdDev()),
|
||||||
|
)
|
||||||
|
}
|
||||||
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
func (s *ForwardStats) GetLastStats(duration time.Duration) (latency, jitter time.Duration) {
|
func (s *ForwardStats) GetLastStats(duration time.Duration) (latency, jitter time.Duration) {
|
||||||
|
|||||||
Reference in New Issue
Block a user