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:
Yuri Tseretyan
2023-03-27 11:55:13 -04:00
committed by GitHub
parent 36e8ca7f13
commit 52a0f59706
21 changed files with 279 additions and 182 deletions
+4 -4
View File
@@ -99,12 +99,12 @@ func alertRuleGen() func() apimodels.PostableExtendedRuleNode {
GrafanaManagedAlert: &apimodels.PostableGrafanaRule{
Title: fmt.Sprintf("rule-%s", util.GenerateShortUID()),
Condition: "A",
Data: []ngmodels.AlertQuery{
Data: []apimodels.AlertQuery{
{
RefID: "A",
RelativeTimeRange: ngmodels.RelativeTimeRange{
From: ngmodels.Duration(time.Duration(5) * time.Hour),
To: ngmodels.Duration(time.Duration(3) * time.Hour),
RelativeTimeRange: apimodels.RelativeTimeRange{
From: apimodels.Duration(time.Duration(5) * time.Hour),
To: apimodels.Duration(time.Duration(3) * time.Hour),
},
DatasourceUID: expr.DatasourceUID,
Model: json.RawMessage(`{