Commit 0433af63 by Andrej Ocenas Committed by GitHub

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
parent fef36380
...@@ -3,7 +3,6 @@ package alerting ...@@ -3,7 +3,6 @@ package alerting
import ( import (
"errors" "errors"
"fmt" "fmt"
"time"
"github.com/grafana/grafana/pkg/bus" "github.com/grafana/grafana/pkg/bus"
"github.com/grafana/grafana/pkg/components/imguploader" "github.com/grafana/grafana/pkg/components/imguploader"
...@@ -127,7 +126,7 @@ func (n *notificationService) uploadImage(context *EvalContext) (err error) { ...@@ -127,7 +126,7 @@ func (n *notificationService) uploadImage(context *EvalContext) (err error) {
renderOpts := rendering.Opts{ renderOpts := rendering.Opts{
Width: 1000, Width: 1000,
Height: 500, Height: 500,
Timeout: time.Duration(setting.AlertingEvaluationTimeout.Seconds() * 0.9), Timeout: setting.AlertingEvaluationTimeout,
OrgId: context.Rule.OrgId, OrgId: context.Rule.OrgId,
OrgRole: m.ROLE_ADMIN, OrgRole: m.ROLE_ADMIN,
ConcurrentLimit: setting.AlertingRenderLimit, ConcurrentLimit: setting.AlertingRenderLimit,
......
...@@ -886,8 +886,10 @@ func (cfg *Cfg) Load(args *CommandLineArgs) error { ...@@ -886,8 +886,10 @@ func (cfg *Cfg) Load(args *CommandLineArgs) error {
return err return err
} }
AlertingEvaluationTimeout = alerting.Key("evaluation_timeout_seconds").MustDuration(time.Second * 30) evaluationTimeoutSeconds := alerting.Key("evaluation_timeout_seconds").MustInt64(30)
AlertingNotificationTimeout = alerting.Key("notification_timeout_seconds").MustDuration(time.Second * 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) AlertingMaxAttempts = alerting.Key("max_attempts").MustInt(3)
explore := iniFile.Section("explore") explore := iniFile.Section("explore")
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment