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