From 61b890b80b22bbde02856632c5aba4b4fe918357 Mon Sep 17 00:00:00 2001 From: Bomin Zhang Date: Tue, 8 Sep 2020 16:51:35 +0800 Subject: [PATCH] fix td-1252 --- alert/app/rule.go | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) diff --git a/alert/app/rule.go b/alert/app/rule.go index d1ab9776fe..44596ca26d 100644 --- a/alert/app/rule.go +++ b/alert/app/rule.go @@ -121,7 +121,21 @@ func (alert *Alert) refresh(rule *Rule, values map[string]interface{}) { alert.Values = values res := rule.Expr.Eval(func(key string) interface{} { // ToLower is required as column name in result is in lower case - return alert.Values[strings.ToLower(key)] + i := alert.Values[strings.ToLower(key)] + switch v := i.(type) { + case int8: + return int64(v) + case int16: + return int64(v) + case int: + return int64(v) + case int32: + return int64(v) + case float32: + return float64(v) + default: + return v + } }) val, ok := res.(bool) -- GitLab