Chore: Remove expr imports (#64543)

* Remove expr imports

* Add comment
pull/65308/head
ismail simsek 2 years ago committed by GitHub
parent a5c5db3e91
commit 3cfb7ac0dd
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 3
      pkg/services/sqlstore/migrations/ualert/alert_rule.go
  2. 3
      pkg/services/sqlstore/migrations/ualert/cond_trans.go
  3. 3
      pkg/services/sqlstore/migrations/ualert/ualert.go

@ -6,7 +6,6 @@ import (
"time"
"github.com/grafana/grafana/pkg/components/simplejson"
"github.com/grafana/grafana/pkg/expr"
legacymodels "github.com/grafana/grafana/pkg/services/alerting/models"
ngmodels "github.com/grafana/grafana/pkg/services/ngalert/models"
"github.com/grafana/grafana/pkg/tsdb/graphite"
@ -180,7 +179,7 @@ func migrateAlertRuleQueries(data []alertQuery) ([]alertQuery, error) {
result := make([]alertQuery, 0, len(data))
for _, d := range data {
// queries that are expression are not relevant, skip them.
if d.DatasourceUID == expr.DatasourceType {
if d.DatasourceUID == expressionDatasourceUID {
result = append(result, d)
continue
}

@ -7,7 +7,6 @@ import (
"strings"
"time"
"github.com/grafana/grafana/pkg/expr"
"github.com/grafana/grafana/pkg/util"
)
@ -188,7 +187,7 @@ func transConditions(set dashAlertSettings, orgID int64, dsUIDMap dsUIDLookup) (
ccAlertQuery := alertQuery{
RefID: ccRefID,
Model: exprModelJSON,
DatasourceUID: expr.DatasourceUID,
DatasourceUID: expressionDatasourceUID,
}
newCond.Data = append(newCond.Data, ccAlertQuery)

@ -43,6 +43,9 @@ var rmMigTitle = "remove unified alerting data"
const clearMigrationEntryTitle = "clear migration entry %q"
const codeMigration = "code migration"
// It is defined in pkg/expr/service.go as "DatasourceType"
const expressionDatasourceUID = "__expr__"
type MigrationError struct {
AlertId int64
Err error

Loading…
Cancel
Save