mirror of
https://github.com/TeaOSLab/EdgeAPI.git
synced 2025-11-05 01:20:25 +08:00
统计带宽计算增加最小样本数
This commit is contained in:
@@ -380,7 +380,7 @@ func (this *ServerBandwidthStatDAO) FindAllServerStatsWithMonth(tx *dbs.Tx, serv
|
|||||||
}
|
}
|
||||||
|
|
||||||
// FindMonthlyPercentile 获取某月内百分位
|
// FindMonthlyPercentile 获取某月内百分位
|
||||||
func (this *ServerBandwidthStatDAO) FindMonthlyPercentile(tx *dbs.Tx, serverId int64, month string, percentile int, useAvg bool, noPlan bool) (result int64, err error) {
|
func (this *ServerBandwidthStatDAO) FindMonthlyPercentile(tx *dbs.Tx, serverId int64, month string, percentile int, useAvg bool, noPlan bool, minSamples int) (result int64, err error) {
|
||||||
if percentile <= 0 {
|
if percentile <= 0 {
|
||||||
percentile = 95
|
percentile = 95
|
||||||
}
|
}
|
||||||
@@ -415,7 +415,7 @@ func (this *ServerBandwidthStatDAO) FindMonthlyPercentile(tx *dbs.Tx, serverId i
|
|||||||
if err != nil {
|
if err != nil {
|
||||||
return 0, err
|
return 0, err
|
||||||
}
|
}
|
||||||
if total == 0 {
|
if total == 0 || total < int64(minSamples) {
|
||||||
return 0, nil
|
return 0, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user