Alerting: introduce AlertQuery in definitions package (#63825)
* copy AlertQuery from ngmodels to the definition package * replaces usages of ngmodels.AlertQuery in API models * create a converter between models of AlertQuery --------- Co-authored-by: Alex Moreno <alexander.moreno@grafana.com>
This commit is contained in:
co-authored by
Alex Moreno
parent
36e8ca7f13
commit
52a0f59706
@@ -76,10 +76,11 @@ func validateRuleNode(
|
||||
}
|
||||
}
|
||||
|
||||
if len(ruleNode.GrafanaManagedAlert.Data) != 0 {
|
||||
queries := AlertQueriesFromApiAlertQueries(ruleNode.GrafanaManagedAlert.Data)
|
||||
if len(queries) != 0 {
|
||||
cond := ngmodels.Condition{
|
||||
Condition: ruleNode.GrafanaManagedAlert.Condition,
|
||||
Data: ruleNode.GrafanaManagedAlert.Data,
|
||||
Data: queries,
|
||||
}
|
||||
if err = conditionValidator(cond); err != nil {
|
||||
return nil, fmt.Errorf("failed to validate condition of alert rule %s: %w", ruleNode.GrafanaManagedAlert.Title, err)
|
||||
@@ -90,7 +91,7 @@ func validateRuleNode(
|
||||
OrgID: orgId,
|
||||
Title: ruleNode.GrafanaManagedAlert.Title,
|
||||
Condition: ruleNode.GrafanaManagedAlert.Condition,
|
||||
Data: ruleNode.GrafanaManagedAlert.Data,
|
||||
Data: queries,
|
||||
UID: ruleNode.GrafanaManagedAlert.UID,
|
||||
IntervalSeconds: intervalSeconds,
|
||||
NamespaceUID: namespace.UID,
|
||||
|
||||
Reference in New Issue
Block a user