Browse Source

Config: Fixes bug where timeouts for alerting was not parsed correctly (#16784)

* Fix parsing of the config

* Remove unnecessary conversion

* Remove timeout modification

Co-Authored-By: aocenas <mr.ocenas@gmail.com>

* Remove unused import
Andrej Ocenas 6 years ago
parent
commit
0433af6385
2 changed files with 5 additions and 4 deletions
  1. 1 2
      pkg/services/alerting/notifier.go
  2. 4 2
      pkg/setting/setting.go

+ 1 - 2
pkg/services/alerting/notifier.go

@@ -3,7 +3,6 @@ package alerting
 import (
 	"errors"
 	"fmt"
-	"time"
 
 	"github.com/grafana/grafana/pkg/bus"
 	"github.com/grafana/grafana/pkg/components/imguploader"
@@ -127,7 +126,7 @@ func (n *notificationService) uploadImage(context *EvalContext) (err error) {
 	renderOpts := rendering.Opts{
 		Width:           1000,
 		Height:          500,
-		Timeout:         time.Duration(setting.AlertingEvaluationTimeout.Seconds() * 0.9),
+		Timeout:         setting.AlertingEvaluationTimeout,
 		OrgId:           context.Rule.OrgId,
 		OrgRole:         m.ROLE_ADMIN,
 		ConcurrentLimit: setting.AlertingRenderLimit,

+ 4 - 2
pkg/setting/setting.go

@@ -886,8 +886,10 @@ func (cfg *Cfg) Load(args *CommandLineArgs) error {
 		return err
 	}
 
-	AlertingEvaluationTimeout = alerting.Key("evaluation_timeout_seconds").MustDuration(time.Second * 30)
-	AlertingNotificationTimeout = alerting.Key("notification_timeout_seconds").MustDuration(time.Second * 30)
+	evaluationTimeoutSeconds := alerting.Key("evaluation_timeout_seconds").MustInt64(30)
+	AlertingEvaluationTimeout = time.Second * time.Duration(evaluationTimeoutSeconds)
+	notificationTimeoutSeconds := alerting.Key("notification_timeout_seconds").MustInt64(30)
+	AlertingNotificationTimeout = time.Second * time.Duration(notificationTimeoutSeconds)
 	AlertingMaxAttempts = alerting.Key("max_attempts").MustInt(3)
 
 	explore := iniFile.Section("explore")