Skip to content

Commit

Permalink
Merge pull request open-falcon#4 from Liuyanglong/master
Browse files Browse the repository at this point in the history
config中的Remain 与 采点数 取小
  • Loading branch information
xingfusye committed Mar 29, 2016
2 parents 82c5ae7 + 83e837c commit 1280b87
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion store/func.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import (
"fmt"
"github.com/open-falcon/common/model"
"math"
"github.com/open-falcon/judge/g"
"strconv"
"strings"
)
Expand Down Expand Up @@ -209,10 +210,13 @@ func (this PDiffFunction) Compute(L *SafeLinkedList) (vs []*model.HistoryData, l
// @str: e.g. all(#3) sum(#3) avg(#10) diff(#10)
func ParseFuncFromString(str string, operator string, rightValue float64) (fn Function, err error) {
idx := strings.Index(str, "#")
limit, err := strconv.ParseInt(str[idx+1:len(str)-1], 10, 64)
limit, err := strconv.Atoi(str[idx+1:len(str)-1])
if err != nil {
return nil, err
}
if g.Config().Remain <= limit {
limit = g.Config().Remain
}

switch str[:idx-1] {
case "max":
Expand Down

0 comments on commit 1280b87

Please sign in to comment.