From 2d2e0585639d8a4d89eeffd3228e123f87159b95 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jean-Philippe=20Qu=C3=A9m=C3=A9ner?= Date: Fri, 17 Nov 2023 01:07:35 +0100 Subject: [PATCH] refactor: use constant for prometheus datasource type (#78287) --- pkg/services/ngalert/migration/alert_rule.go | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/pkg/services/ngalert/migration/alert_rule.go b/pkg/services/ngalert/migration/alert_rule.go index be8d39a3da1..3ef0b56bf33 100644 --- a/pkg/services/ngalert/migration/alert_rule.go +++ b/pkg/services/ngalert/migration/alert_rule.go @@ -9,6 +9,7 @@ import ( "github.com/grafana/grafana/pkg/components/simplejson" "github.com/grafana/grafana/pkg/infra/log" legacymodels "github.com/grafana/grafana/pkg/services/alerting/models" + "github.com/grafana/grafana/pkg/services/datasources" migmodels "github.com/grafana/grafana/pkg/services/ngalert/migration/models" migrationStore "github.com/grafana/grafana/pkg/services/ngalert/migration/store" ngmodels "github.com/grafana/grafana/pkg/services/ngalert/models" @@ -235,7 +236,7 @@ func isPrometheusQuery(queryData map[string]json.RawMessage) (bool, error) { if datasource.Type == "" { return false, fmt.Errorf("missing type field '%s'", string(ds)) } - return datasource.Type == "prometheus", nil + return datasource.Type == datasources.DS_PROMETHEUS, nil } func ruleAdjustInterval(freq int64) int64 {