diff --git a/pkg/api/metrics.go b/pkg/api/metrics.go index dad3b159ad6..9194637af15 100644 --- a/pkg/api/metrics.go +++ b/pkg/api/metrics.go @@ -33,7 +33,7 @@ func QueryMetrics(c *middleware.Context, reqDto dtos.MetricRequest) Response { }) } - resp, err := tsdb.HandleRequest(context.TODO(), request) + resp, err := tsdb.HandleRequest(context.Background(), request) if err != nil { return ApiError(500, "Metric request error", err) } diff --git a/pkg/services/alerting/engine.go b/pkg/services/alerting/engine.go index b99b7506614..51d48287c14 100644 --- a/pkg/services/alerting/engine.go +++ b/pkg/services/alerting/engine.go @@ -98,7 +98,7 @@ func (e *Engine) processJob(grafanaCtx context.Context, job *Job) error { } }() - alertCtx, cancelFn := context.WithTimeout(context.TODO(), alertTimeout) + alertCtx, cancelFn := context.WithTimeout(context.Background(), alertTimeout) job.Running = true evalContext := NewEvalContext(alertCtx, job.Rule) diff --git a/pkg/services/alerting/test_notification.go b/pkg/services/alerting/test_notification.go index d5def91d1c5..91b3814ac7b 100644 --- a/pkg/services/alerting/test_notification.go +++ b/pkg/services/alerting/test_notification.go @@ -50,7 +50,7 @@ func createTestEvalContext(cmd *NotificationTestCommand) *EvalContext { State: m.AlertStateAlerting, } - ctx := NewEvalContext(context.TODO(), testRule) + ctx := NewEvalContext(context.Background(), testRule) if cmd.Settings.Get("uploadImage").MustBool(true) { ctx.ImagePublicUrl = "http://grafana.org/assets/img/blog/mixed_styles.png" } diff --git a/pkg/services/alerting/test_rule.go b/pkg/services/alerting/test_rule.go index 82b1a6276a1..e3aa95e0ede 100644 --- a/pkg/services/alerting/test_rule.go +++ b/pkg/services/alerting/test_rule.go @@ -49,7 +49,7 @@ func handleAlertTestCommand(cmd *AlertTestCommand) error { func testAlertRule(rule *Rule) *EvalContext { handler := NewEvalHandler() - context := NewEvalContext(context.TODO(), rule) + context := NewEvalContext(context.Background(), rule) context.IsTestRun = true handler.Eval(context) diff --git a/pkg/services/notifications/webhook.go b/pkg/services/notifications/webhook.go index cf39af10478..bab8519f566 100644 --- a/pkg/services/notifications/webhook.go +++ b/pkg/services/notifications/webhook.go @@ -37,7 +37,7 @@ func processWebhookQueue() { for { select { case webhook := <-webhookQueue: - err := sendWebRequestSync(context.TODO(), webhook) + err := sendWebRequestSync(context.Background(), webhook) if err != nil { webhookLog.Error("Failed to send webrequest ", "error", err)