Skip to content

Commit a50524e

Browse files
author
humingcheng
committed
Fix bug: when all the requests is shor-circuited, failure rate is 100%
1 parent 6ca34ff commit a50524e

File tree

1 file changed

+1
-2
lines changed

1 file changed

+1
-2
lines changed

monitorData.go

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -121,11 +121,10 @@ func (monitorData *MonitorData) appendInterfaceInfo(name string, i interface{})
121121
interfaceInfo.Latency = int(t.Mean() / float64(time.Millisecond))
122122
}
123123
}
124+
interfaceInfo.Rate = 1 //rate is no use any more and must be set to 1
124125
if interfaceInfo.Total == 0 {
125-
interfaceInfo.Rate = 100
126126
interfaceInfo.FailureRate = 0
127127
} else {
128-
interfaceInfo.Rate = float64(interfaceInfo.successCount) / float64(interfaceInfo.Total)
129128
totalErrorCount := interfaceInfo.Failure + interfaceInfo.SemaphoreRejected + interfaceInfo.ThreadPoolRejected + interfaceInfo.CountTimeout
130129
if totalErrorCount == 0 {
131130
interfaceInfo.FailureRate = 0

0 commit comments

Comments
 (0)