mirror of
https://github.com/TeaOSLab/EdgeNode.git
synced 2025-11-09 12:00:26 +08:00
统计API调用时低于一半的采样率返回总统计
This commit is contained in:
@@ -45,8 +45,13 @@ func (this *CallStat) Sum() (successPercent float64, avgCostSeconds float64) {
|
|||||||
this.locker.Lock()
|
this.locker.Lock()
|
||||||
defer this.locker.Unlock()
|
defer this.locker.Unlock()
|
||||||
|
|
||||||
|
var size = this.size
|
||||||
|
if size <= 0 {
|
||||||
|
size = 10
|
||||||
|
}
|
||||||
|
|
||||||
var totalItems = len(this.items)
|
var totalItems = len(this.items)
|
||||||
if totalItems == 0 {
|
if totalItems <= size/2 /** 低于一半的采样率,不计入统计 **/ {
|
||||||
successPercent = 100
|
successPercent = 100
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user