avoid logging on small values (#3958)

This commit is contained in:
Raja Subramanian
2025-09-28 10:46:41 +05:30
committed by GitHub
parent 00ff2ab941
commit 0bf7b178eb
+4 -4
View File
@@ -11,8 +11,8 @@ import (
) )
const ( const (
highForwardingLatency = 20 * time.Millisecond cHighForwardingLatency = 20 * time.Millisecond
skewFactor = 10 cSkewFactor = 10
) )
type ForwardStats struct { type ForwardStats struct {
@@ -38,7 +38,7 @@ func NewForwardStats(latencyUpdateInterval, reportInterval, latencyWindowLength
func (s *ForwardStats) Update(arrival, left int64) (int64, bool) { func (s *ForwardStats) Update(arrival, left int64) (int64, bool) {
transit := left - arrival transit := left - arrival
isHighForwardingLatency := false isHighForwardingLatency := false
if time.Duration(transit) > highForwardingLatency { if time.Duration(transit) > cHighForwardingLatency {
isHighForwardingLatency = true isHighForwardingLatency = true
} }
@@ -72,7 +72,7 @@ func (s *ForwardStats) GetStats(shortDuration time.Duration) (time.Duration, tim
latencyLong, jitterLong := time.Duration(wLong.Mean()), time.Duration(wLong.StdDev()) latencyLong, jitterLong := time.Duration(wLong.Mean()), time.Duration(wLong.StdDev())
latencyShort, jitterShort := time.Duration(wShort.Mean()), time.Duration(wShort.StdDev()) latencyShort, jitterShort := time.Duration(wShort.Mean()), time.Duration(wShort.StdDev())
if jitterLong > latencyLong*skewFactor { if latencyShort > cHighForwardingLatency/2 && jitterLong > latencyLong*cSkewFactor {
logger.Infow( logger.Infow(
"high jitter in forwarding path", "high jitter in forwarding path",
"lowest", time.Duration(lowest), "lowest", time.Duration(lowest),