mirror of
https://github.com/nezhahq/nezha.git
synced 2025-03-11 08:18:13 -04:00
fix: reset ping value correctly after reaching average count in ServiceSentinel
This commit is contained in:
parent
9b6c3391ed
commit
4844b1d8a3
@ -427,7 +427,6 @@ func (ss *ServiceSentinel) worker() {
|
||||
ts.ping = (ts.ping*float32(ts.count-1) + mh.Delay) / float32(ts.count)
|
||||
if ts.count == Conf.AvgPingCount {
|
||||
ts.count = 0
|
||||
ts.ping = mh.Delay
|
||||
if err := DB.Create(&model.ServiceHistory{
|
||||
ServiceID: mh.GetId(),
|
||||
AvgDelay: ts.ping,
|
||||
@ -436,6 +435,7 @@ func (ss *ServiceSentinel) worker() {
|
||||
}).Error; err != nil {
|
||||
log.Printf("NEZHA>> Failed to save service monitor metrics: %v", err)
|
||||
}
|
||||
ts.ping = mh.Delay
|
||||
}
|
||||
serviceTcpMap[r.Reporter] = ts
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user