diff --git a/app/vmalert/notifier/alertmanager_request.qtpl.go b/app/vmalert/notifier/alertmanager_request.qtpl.go index 3f4562003f..a3ce41531a 100644 --- a/app/vmalert/notifier/alertmanager_request.qtpl.go +++ b/app/vmalert/notifier/alertmanager_request.qtpl.go @@ -1,140 +1,140 @@ // Code generated by qtc from "alertmanager_request.qtpl". DO NOT EDIT. // See https://github.com/valyala/quicktemplate for details. -//line alertmanager_request.qtpl:1 +//line app/vmalert/notifier/alertmanager_request.qtpl:1 package notifier -//line alertmanager_request.qtpl:1 +//line app/vmalert/notifier/alertmanager_request.qtpl:1 import ( "time" "github.com/VictoriaMetrics/VictoriaMetrics/lib/promrelabel" ) -//line alertmanager_request.qtpl:8 +//line app/vmalert/notifier/alertmanager_request.qtpl:8 import ( qtio422016 "io" qt422016 "github.com/valyala/quicktemplate" ) -//line alertmanager_request.qtpl:8 +//line app/vmalert/notifier/alertmanager_request.qtpl:8 var ( _ = qtio422016.Copy _ = qt422016.AcquireByteBuffer ) -//line alertmanager_request.qtpl:8 +//line app/vmalert/notifier/alertmanager_request.qtpl:8 func streamamRequest(qw422016 *qt422016.Writer, alerts []Alert, generatorURL func(Alert) string, relabelCfg *promrelabel.ParsedConfigs) { - //line alertmanager_request.qtpl:8 +//line app/vmalert/notifier/alertmanager_request.qtpl:8 qw422016.N().S(`[`) - //line alertmanager_request.qtpl:10 +//line app/vmalert/notifier/alertmanager_request.qtpl:10 for i, alert := range alerts { - //line alertmanager_request.qtpl:10 +//line app/vmalert/notifier/alertmanager_request.qtpl:10 qw422016.N().S(`{"startsAt":`) - //line alertmanager_request.qtpl:12 +//line app/vmalert/notifier/alertmanager_request.qtpl:12 qw422016.N().Q(alert.Start.Format(time.RFC3339Nano)) - //line alertmanager_request.qtpl:12 +//line app/vmalert/notifier/alertmanager_request.qtpl:12 qw422016.N().S(`,"generatorURL":`) - //line alertmanager_request.qtpl:13 +//line app/vmalert/notifier/alertmanager_request.qtpl:13 qw422016.N().Q(generatorURL(alert)) - //line alertmanager_request.qtpl:13 +//line app/vmalert/notifier/alertmanager_request.qtpl:13 qw422016.N().S(`,`) - //line alertmanager_request.qtpl:14 +//line app/vmalert/notifier/alertmanager_request.qtpl:14 if !alert.End.IsZero() { - //line alertmanager_request.qtpl:14 +//line app/vmalert/notifier/alertmanager_request.qtpl:14 qw422016.N().S(`"endsAt":`) - //line alertmanager_request.qtpl:15 +//line app/vmalert/notifier/alertmanager_request.qtpl:15 qw422016.N().Q(alert.End.Format(time.RFC3339Nano)) - //line alertmanager_request.qtpl:15 +//line app/vmalert/notifier/alertmanager_request.qtpl:15 qw422016.N().S(`,`) - //line alertmanager_request.qtpl:16 +//line app/vmalert/notifier/alertmanager_request.qtpl:16 } - //line alertmanager_request.qtpl:16 +//line app/vmalert/notifier/alertmanager_request.qtpl:16 qw422016.N().S(`"labels": {`) - //line alertmanager_request.qtpl:18 +//line app/vmalert/notifier/alertmanager_request.qtpl:18 lbls := alert.toPromLabels(relabelCfg) - //line alertmanager_request.qtpl:19 +//line app/vmalert/notifier/alertmanager_request.qtpl:19 ll := len(lbls) - //line alertmanager_request.qtpl:20 +//line app/vmalert/notifier/alertmanager_request.qtpl:20 for idx, l := range lbls { - //line alertmanager_request.qtpl:21 +//line app/vmalert/notifier/alertmanager_request.qtpl:21 qw422016.N().Q(l.Name) - //line alertmanager_request.qtpl:21 +//line app/vmalert/notifier/alertmanager_request.qtpl:21 qw422016.N().S(`:`) - //line alertmanager_request.qtpl:21 +//line app/vmalert/notifier/alertmanager_request.qtpl:21 qw422016.N().Q(l.Value) - //line alertmanager_request.qtpl:21 +//line app/vmalert/notifier/alertmanager_request.qtpl:21 if idx != ll-1 { - //line alertmanager_request.qtpl:21 +//line app/vmalert/notifier/alertmanager_request.qtpl:21 qw422016.N().S(`,`) - //line alertmanager_request.qtpl:21 +//line app/vmalert/notifier/alertmanager_request.qtpl:21 } - //line alertmanager_request.qtpl:22 +//line app/vmalert/notifier/alertmanager_request.qtpl:22 } - //line alertmanager_request.qtpl:22 +//line app/vmalert/notifier/alertmanager_request.qtpl:22 qw422016.N().S(`},"annotations": {`) - //line alertmanager_request.qtpl:25 +//line app/vmalert/notifier/alertmanager_request.qtpl:25 c := len(alert.Annotations) - //line alertmanager_request.qtpl:26 +//line app/vmalert/notifier/alertmanager_request.qtpl:26 for k, v := range alert.Annotations { - //line alertmanager_request.qtpl:27 +//line app/vmalert/notifier/alertmanager_request.qtpl:27 c = c - 1 - //line alertmanager_request.qtpl:28 +//line app/vmalert/notifier/alertmanager_request.qtpl:28 qw422016.N().Q(k) - //line alertmanager_request.qtpl:28 +//line app/vmalert/notifier/alertmanager_request.qtpl:28 qw422016.N().S(`:`) - //line alertmanager_request.qtpl:28 +//line app/vmalert/notifier/alertmanager_request.qtpl:28 qw422016.N().Q(v) - //line alertmanager_request.qtpl:28 +//line app/vmalert/notifier/alertmanager_request.qtpl:28 if c > 0 { - //line alertmanager_request.qtpl:28 +//line app/vmalert/notifier/alertmanager_request.qtpl:28 qw422016.N().S(`,`) - //line alertmanager_request.qtpl:28 +//line app/vmalert/notifier/alertmanager_request.qtpl:28 } - //line alertmanager_request.qtpl:29 +//line app/vmalert/notifier/alertmanager_request.qtpl:29 } - //line alertmanager_request.qtpl:29 +//line app/vmalert/notifier/alertmanager_request.qtpl:29 qw422016.N().S(`}}`) - //line alertmanager_request.qtpl:32 +//line app/vmalert/notifier/alertmanager_request.qtpl:32 if i != len(alerts)-1 { - //line alertmanager_request.qtpl:32 +//line app/vmalert/notifier/alertmanager_request.qtpl:32 qw422016.N().S(`,`) - //line alertmanager_request.qtpl:32 +//line app/vmalert/notifier/alertmanager_request.qtpl:32 } - //line alertmanager_request.qtpl:33 +//line app/vmalert/notifier/alertmanager_request.qtpl:33 } - //line alertmanager_request.qtpl:33 +//line app/vmalert/notifier/alertmanager_request.qtpl:33 qw422016.N().S(`]`) - //line alertmanager_request.qtpl:35 +//line app/vmalert/notifier/alertmanager_request.qtpl:35 } -//line alertmanager_request.qtpl:35 +//line app/vmalert/notifier/alertmanager_request.qtpl:35 func writeamRequest(qq422016 qtio422016.Writer, alerts []Alert, generatorURL func(Alert) string, relabelCfg *promrelabel.ParsedConfigs) { - //line alertmanager_request.qtpl:35 +//line app/vmalert/notifier/alertmanager_request.qtpl:35 qw422016 := qt422016.AcquireWriter(qq422016) - //line alertmanager_request.qtpl:35 +//line app/vmalert/notifier/alertmanager_request.qtpl:35 streamamRequest(qw422016, alerts, generatorURL, relabelCfg) - //line alertmanager_request.qtpl:35 +//line app/vmalert/notifier/alertmanager_request.qtpl:35 qt422016.ReleaseWriter(qw422016) - //line alertmanager_request.qtpl:35 +//line app/vmalert/notifier/alertmanager_request.qtpl:35 } -//line alertmanager_request.qtpl:35 +//line app/vmalert/notifier/alertmanager_request.qtpl:35 func amRequest(alerts []Alert, generatorURL func(Alert) string, relabelCfg *promrelabel.ParsedConfigs) string { - //line alertmanager_request.qtpl:35 +//line app/vmalert/notifier/alertmanager_request.qtpl:35 qb422016 := qt422016.AcquireByteBuffer() - //line alertmanager_request.qtpl:35 +//line app/vmalert/notifier/alertmanager_request.qtpl:35 writeamRequest(qb422016, alerts, generatorURL, relabelCfg) - //line alertmanager_request.qtpl:35 +//line app/vmalert/notifier/alertmanager_request.qtpl:35 qs422016 := string(qb422016.B) - //line alertmanager_request.qtpl:35 +//line app/vmalert/notifier/alertmanager_request.qtpl:35 qt422016.ReleaseByteBuffer(qb422016) - //line alertmanager_request.qtpl:35 +//line app/vmalert/notifier/alertmanager_request.qtpl:35 return qs422016 - //line alertmanager_request.qtpl:35 +//line app/vmalert/notifier/alertmanager_request.qtpl:35 } diff --git a/app/vmalert/web_types.go b/app/vmalert/web_types.go index c61aacdbe6..4c2075224b 100644 --- a/app/vmalert/web_types.go +++ b/app/vmalert/web_types.go @@ -5,11 +5,11 @@ import ( "time" ) -// APIAlert represents a notifier.AlertingRule ruleState +// APIAlert represents a notifier.AlertingRule state // for WEB view // https://github.com/prometheus/compliance/blob/main/alert_generator/specification.md#get-apiv1rules type APIAlert struct { - State string `json:"ruleState"` + State string `json:"state"` Name string `json:"name"` Value string `json:"value"` Labels map[string]string `json:"labels,omitempty"` @@ -30,7 +30,7 @@ type APIAlert struct { // SourceLink contains a link to a system which should show // why Alert was generated SourceLink string `json:"source"` - // Restored shows whether Alert's ruleState was restored on restart + // Restored shows whether Alert's state was restored on restart Restored bool `json:"restored"` } @@ -86,10 +86,10 @@ type GroupAlerts struct { // see https://github.com/prometheus/compliance/blob/main/alert_generator/specification.md#get-apiv1rules type APIRule struct { // State must be one of these under following scenarios - // "pending": at least 1 alert in the rule in pending ruleState and no other alert in firing ruleState. - // "firing": at least 1 alert in the rule in firing ruleState. - // "inactive": no alert in the rule in firing or pending ruleState. - State string `json:"ruleState"` + // "pending": at least 1 alert in the rule in pending state and no other alert in firing ruleState. + // "firing": at least 1 alert in the rule in firing state. + // "inactive": no alert in the rule in firing or pending state. + State string `json:"state"` Name string `json:"name"` // Query represents Rule's `expression` field Query string `json:"query"` @@ -121,7 +121,7 @@ type APIRule struct { // GroupID is an unique Group's ID GroupID string `json:"group_id"` - // TODO: + // Updates contains the ordered list of recorded ruleStateEntry objects Updates []ruleStateEntry `json:"updates"` }