ForwarStats.GetStats needs to be public (#3946)

* ForwarStats.GetStats needs to be public

* prevent deadlock
This commit is contained in:
Raja Subramanian
2025-09-23 15:46:12 +05:30
committed by GitHub
parent 824d116bfe
commit e6a3df1edc
2 changed files with 23 additions and 16 deletions
+2 -2
View File
@@ -49,7 +49,7 @@ func (s *ForwardStats) Update(arrival, left int64) (int64, bool) {
return transit, isHighForwardingLatency
}
func (s *ForwardStats) getStats(shortDuration time.Duration) (time.Duration, time.Duration, time.Duration, time.Duration) {
func (s *ForwardStats) GetStats(shortDuration time.Duration) (time.Duration, time.Duration, time.Duration, time.Duration) {
s.lock.Lock()
wLong := s.latency.Summarize()
wShort := s.latency.SummarizeLast(shortDuration)
@@ -93,7 +93,7 @@ func (s *ForwardStats) report(reportInterval time.Duration) {
return
case <-ticker.C:
latencyLong, jitterLong, latencyShort, jitterShort := s.getStats(reportInterval)
latencyLong, jitterLong, latencyShort, jitterShort := s.GetStats(reportInterval)
prometheus.RecordForwardJitter(uint32(jitterShort.Microseconds()), uint32(jitterLong.Microseconds()))
prometheus.RecordForwardLatency(uint32(latencyShort.Microseconds()), uint32(latencyLong.Microseconds()))
}