Browse Source

fix(Alerting): Fixed alert rules with eval in day units, fixes #16174 (#16182)

Torkel Ödegaard 6 years ago
parent
commit
7c81f4dfd8
2 changed files with 2 additions and 0 deletions
  1. 1 0
      pkg/services/alerting/rule.go
  2. 1 0
      pkg/services/alerting/rule_test.go

+ 1 - 0
pkg/services/alerting/rule.go

@@ -73,6 +73,7 @@ var unitMultiplier = map[string]int{
 	"s": 1,
 	"m": 60,
 	"h": 3600,
+	"d": 86400,
 }
 
 func getTimeDurationStringToSeconds(str string) (int64, error) {

+ 1 - 0
pkg/services/alerting/rule_test.go

@@ -24,6 +24,7 @@ func TestAlertRuleFrequencyParsing(t *testing.T) {
 		{input: "10s", result: 10},
 		{input: "10m", result: 600},
 		{input: "1h", result: 3600},
+		{input: "1d", result: 86400},
 		{input: "1o", result: 1},
 		{input: "0s", err: ErrFrequencyCannotBeZeroOrLess},
 		{input: "0m", err: ErrFrequencyCannotBeZeroOrLess},