From 27bafdab53c12c239bf4e07e5dd7ebe8bcd22b2a Mon Sep 17 00:00:00 2001 From: Chris Goller Date: Fri, 10 Feb 2017 10:06:26 -0600 Subject: [PATCH] Update function name for kapacitor's formatting of values --- kapacitor/vars.go | 12 ++++-------- 1 file changed, 4 insertions(+), 8 deletions(-) diff --git a/kapacitor/vars.go b/kapacitor/vars.go index 0c1cfd147b..081f349fb7 100644 --- a/kapacitor/vars.go +++ b/kapacitor/vars.go @@ -40,10 +40,7 @@ func Vars(rule chronograf.AlertRule) (string, error) { %s var crit = %s ` - // If critical value is a string, we'll - // need to single-quote it. - crit := critVar(rule.TriggerValues.Value) - return fmt.Sprintf(vars, common, crit), nil + return fmt.Sprintf(vars, common, formatValue(rule.TriggerValues.Value)), nil } else { vars := ` %s @@ -181,10 +178,9 @@ func whereFilter(q chronograf.QueryConfig) string { return "lambda: TRUE" } -// critVar return the same string if a numeric type -// or if it is a string will return it as a kapacitor -// formatted single-quoted string -func critVar(value string) string { +// formatValue return the same string if a numeric type or if it is a string +// will return it as a kapacitor formatted single-quoted string +func formatValue(value string) string { // Test if numeric if it can be converted to a float if _, err := strconv.ParseFloat(value, 64); err == nil { return value