From 0433af63855d4c976614d391e8a3a2170c341b31 Mon Sep 17 00:00:00 2001 From: Andrej Ocenas Date: Tue, 30 Apr 2019 12:05:38 +0200 Subject: [PATCH] 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 * Remove unused import --- pkg/services/alerting/notifier.go | 3 +-- pkg/setting/setting.go | 6 ++++-- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/pkg/services/alerting/notifier.go b/pkg/services/alerting/notifier.go index 1a0a910a5d3..c28ac49b894 100644 --- a/pkg/services/alerting/notifier.go +++ b/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, diff --git a/pkg/setting/setting.go b/pkg/setting/setting.go index 0ed02f7f0ed..98aaa45d7de 100644 --- a/pkg/setting/setting.go +++ b/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")