From 83e837ce7861681acc8ddb1624f1e3ee082bdd3e Mon Sep 17 00:00:00 2001 From: liuyanglong Date: Sat, 26 Mar 2016 12:06:58 +0800 Subject: [PATCH] =?UTF-8?q?config=E4=B8=AD=E7=9A=84Remain=20=E4=B8=8E=20?= =?UTF-8?q?=E9=87=87=E7=82=B9=E6=95=B0=20=E5=8F=96=E5=B0=8F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- store/func.go | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/store/func.go b/store/func.go index cb90d3570..7e0188e87 100644 --- a/store/func.go +++ b/store/func.go @@ -4,6 +4,7 @@ import ( "fmt" "github.com/open-falcon/common/model" "math" + "github.com/open-falcon/judge/g" "strconv" "strings" ) @@ -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":