diff --git a/app/vmalert/README.md b/app/vmalert/README.md index d5aceec797..38f73f7bfd 100644 --- a/app/vmalert/README.md +++ b/app/vmalert/README.md @@ -99,12 +99,24 @@ name: # By default "prometheus" type is used. [ type: ] -# Optional list of label filters applied to every rule's -# request withing a group. Is compatible only with VM datasource. -# See more details at https://docs.victoriametrics.com#prometheus-querying-api-enhancements +# Warning: DEPRECATED +# Please use `params` instead: +# params: +# extra_label: ["job=nodeexporter", "env=prod"] extra_filter_labels: [ : ... ] +# Optional list of HTTP URL parameters +# applied for all rules requests within a group +# For example: +# params: +# nocache: ["1"] # disable caching for vmselect +# denyPartialResponse: ["true"] # fail if one or more vmstorage nodes returned an error +# extra_label: ["env=dev"] # apply additional label filter "env=dev" for all requests +# see more details at https://docs.victoriametrics.com#prometheus-querying-api-enhancements +params: + [ : [, ...]] + # Optional list of labels added to every rule within a group. # It has priority over the external labels. # Labels are commonly used for adding environment @@ -472,6 +484,8 @@ a review to the dashboard. ## Configuration +### Flags + Pass `-help` to `vmalert` in order to see the full list of supported command-line flags with their descriptions. @@ -693,12 +707,32 @@ The shortlist of configuration flags is the following: Show VictoriaMetrics version ``` +### Hot config reload `vmalert` supports "hot" config reload via the following methods: * send SIGHUP signal to `vmalert` process; * send GET request to `/-/reload` endpoint; * configure `-rule.configCheckInterval` flag for periodic reload on config change. +### URL params + +To set additional URL params for `datasource.url`, `remoteWrite.url` or `remoteRead.url` +just add them in address: `-datasource.url=http://localhost:8428?nocache=1`. + +To set additional URL params for specific [group of rules](#Groups) modify +the `params` group: +```yaml +groups: + - name: TestGroup + params: + denyPartialResponse: ["true"] + extra_label: ["env=dev"] +``` +Please note, `params` are used only for executing rules expressions (requests to `datasource.url`). +If there would be a conflict between URL params set in `datasource.url` flag and params in group definition +the latter will have higher priority. + + ## Contributing `vmalert` is mostly designed and built by VictoriaMetrics community. diff --git a/app/vmalert/alerting.go b/app/vmalert/alerting.go index 9342ebe0f0..67259c7921 100644 --- a/app/vmalert/alerting.go +++ b/app/vmalert/alerting.go @@ -71,7 +71,7 @@ func newAlertingRule(qb datasource.QuerierBuilder, group *Group, cfg config.Rule q: qb.BuildWithParams(datasource.QuerierParams{ DataSourceType: &group.Type, EvaluationInterval: group.Interval, - ExtraLabels: group.ExtraFilterLabels, + QueryParams: group.Params, }), alerts: make(map[uint64]*notifier.Alert), metrics: &alertingRuleMetrics{}, diff --git a/app/vmalert/config/config.go b/app/vmalert/config/config.go index a637062597..4f0dec6099 100644 --- a/app/vmalert/config/config.go +++ b/app/vmalert/config/config.go @@ -5,17 +5,18 @@ import ( "fmt" "hash/fnv" "io/ioutil" + "net/url" "path/filepath" "sort" "strings" - "github.com/VictoriaMetrics/VictoriaMetrics/app/vmalert/datasource" + "gopkg.in/yaml.v2" + "github.com/VictoriaMetrics/VictoriaMetrics/app/vmalert/datasource" "github.com/VictoriaMetrics/VictoriaMetrics/app/vmalert/notifier" "github.com/VictoriaMetrics/VictoriaMetrics/app/vmalert/utils" "github.com/VictoriaMetrics/VictoriaMetrics/lib/envtemplate" "github.com/VictoriaMetrics/VictoriaMetrics/lib/logger" - "gopkg.in/yaml.v2" ) // Group contains list of Rules grouped into @@ -30,6 +31,7 @@ type Group struct { // ExtraFilterLabels is a list label filters applied to every rule // request withing a group. Is compatible only with VM datasources. // See https://docs.victoriametrics.com#prometheus-querying-api-enhancements + // DEPRECATED: use Params field instead ExtraFilterLabels map[string]string `yaml:"extra_filter_labels"` // Labels is a set of label value pairs, that will be added to every rule. // It has priority over the external labels. @@ -37,11 +39,15 @@ type Group struct { // Checksum stores the hash of yaml definition for this group. // May be used to detect any changes like rules re-ordering etc. Checksum string + // Optional HTTP URL parameters added to each rule request + Params url.Values `yaml:"params"` // Catches all undefined fields and must be empty after parsing. XXX map[string]interface{} `yaml:",inline"` } +const extraLabelParam = "extra_label" + // UnmarshalYAML implements the yaml.Unmarshaler interface. func (g *Group) UnmarshalYAML(unmarshal func(interface{}) error) error { type group Group @@ -57,6 +63,16 @@ func (g *Group) UnmarshalYAML(unmarshal func(interface{}) error) error { g.Type.Set(datasource.NewPrometheusType()) } + // backward compatibility with deprecated `ExtraFilterLabels` param + if len(g.ExtraFilterLabels) > 0 { + if g.Params == nil { + g.Params = url.Values{} + } + for k, v := range g.ExtraFilterLabels { + g.Params.Add(extraLabelParam, fmt.Sprintf("%s=%s", k, v)) + } + } + h := md5.New() h.Write(b) g.Checksum = fmt.Sprintf("%x", h.Sum(nil)) @@ -178,6 +194,7 @@ func Parse(pathPatterns []string, validateAnnotations, validateExpressions bool) fp = append(fp, matches...) } errGroup := new(utils.ErrGroup) + var isExtraFilterLabelsUsed bool var groups []Group for _, file := range fp { uniqueGroups := map[string]struct{}{} @@ -197,6 +214,9 @@ func Parse(pathPatterns []string, validateAnnotations, validateExpressions bool) } uniqueGroups[g.Name] = struct{}{} g.File = file + if len(g.ExtraFilterLabels) > 0 { + isExtraFilterLabelsUsed = true + } groups = append(groups, g) } } @@ -206,6 +226,9 @@ func Parse(pathPatterns []string, validateAnnotations, validateExpressions bool) if len(groups) < 1 { logger.Warnf("no groups found in %s", strings.Join(pathPatterns, ";")) } + if isExtraFilterLabelsUsed { + logger.Warnf("field `extra_filter_labels` is deprecated - use `params` instead") + } return groups, nil } diff --git a/app/vmalert/config/config_test.go b/app/vmalert/config/config_test.go index 8acdafb74d..626baa75b7 100644 --- a/app/vmalert/config/config_test.go +++ b/app/vmalert/config/config_test.go @@ -7,10 +7,11 @@ import ( "testing" "time" + "gopkg.in/yaml.v2" + "github.com/VictoriaMetrics/VictoriaMetrics/app/vmalert/datasource" "github.com/VictoriaMetrics/VictoriaMetrics/app/vmalert/notifier" "github.com/VictoriaMetrics/VictoriaMetrics/app/vmalert/utils" - "gopkg.in/yaml.v2" ) func TestMain(m *testing.M) { @@ -472,6 +473,85 @@ concurrency: 16 rules: - alert: ExampleAlertWithFor expr: sum by(job) (up == 1) +`) + }) + + t.Run("`params` change", func(t *testing.T) { + f(t, ` +name: TestGroup +params: + nocache: ["1"] +rules: + - alert: foo + expr: sum by(job) (up == 1) +`, ` +name: TestGroup +params: + nocache: ["0"] +rules: + - alert: foo + expr: sum by(job) (up == 1) `) }) } + +func TestGroupParams(t *testing.T) { + f := func(t *testing.T, data string, expParams url.Values) { + t.Helper() + var g Group + if err := yaml.Unmarshal([]byte(data), &g); err != nil { + t.Fatalf("failed to unmarshal: %s", err) + } + got, exp := g.Params.Encode(), expParams.Encode() + if got != exp { + t.Fatalf("expected to have %q; got %q", exp, got) + } + } + + t.Run("no params", func(t *testing.T) { + f(t, ` +name: TestGroup +rules: + - alert: ExampleAlertAlwaysFiring + expr: sum by(job) (up == 1) +`, url.Values{}) + }) + + t.Run("params", func(t *testing.T) { + f(t, ` +name: TestGroup +params: + nocache: ["1"] + denyPartialResponse: ["true"] +rules: + - alert: ExampleAlertAlwaysFiring + expr: sum by(job) (up == 1) +`, url.Values{"nocache": {"1"}, "denyPartialResponse": {"true"}}) + }) + + t.Run("extra labels", func(t *testing.T) { + f(t, ` +name: TestGroup +extra_filter_labels: + job: victoriametrics + env: prod +rules: + - alert: ExampleAlertAlwaysFiring + expr: sum by(job) (up == 1) +`, url.Values{extraLabelParam: {"job=victoriametrics", "env=prod"}}) + }) + + t.Run("extra labels and params", func(t *testing.T) { + f(t, ` +name: TestGroup +extra_filter_labels: + job: victoriametrics +params: + nocache: ["1"] + extra_label: ["env=prod"] +rules: + - alert: ExampleAlertAlwaysFiring + expr: sum by(job) (up == 1) +`, url.Values{"nocache": {"1"}, extraLabelParam: {"env=prod", "job=victoriametrics"}}) + }) +} diff --git a/app/vmalert/config/testdata/rules0-good.rules b/app/vmalert/config/testdata/rules0-good.rules index 7d7df09b11..da170bef35 100644 --- a/app/vmalert/config/testdata/rules0-good.rules +++ b/app/vmalert/config/testdata/rules0-good.rules @@ -1,5 +1,8 @@ groups: - name: groupGorSingleAlert + params: + nocache: ["1"] + denyPartialResponse: ["true"] rules: - alert: VMRows for: 10s diff --git a/app/vmalert/config/testdata/rules2-good.rules b/app/vmalert/config/testdata/rules2-good.rules index d1a1c4260a..c307375ac9 100644 --- a/app/vmalert/config/testdata/rules2-good.rules +++ b/app/vmalert/config/testdata/rules2-good.rules @@ -2,8 +2,11 @@ groups: - name: TestGroup interval: 2s concurrency: 2 - extra_filter_labels: + extra_filter_labels: # deprecated param, use `params` instead job: victoriametrics + params: + denyPartialResponse: ["true"] + extra_label: ["env=dev"] rules: - alert: Conns expr: sum(vm_tcplistener_conns) by(instance) > 1 diff --git a/app/vmalert/datasource/datasource.go b/app/vmalert/datasource/datasource.go index 8dcff5e5db..e74f373147 100644 --- a/app/vmalert/datasource/datasource.go +++ b/app/vmalert/datasource/datasource.go @@ -2,6 +2,7 @@ package datasource import ( "context" + "net/url" "time" ) @@ -20,8 +21,7 @@ type QuerierBuilder interface { type QuerierParams struct { DataSourceType *Type EvaluationInterval time.Duration - // see https://docs.victoriametrics.com/#prometheus-querying-api-enhancements - ExtraLabels map[string]string + QueryParams url.Values } // Metric is the basic entity which should be return by datasource diff --git a/app/vmalert/datasource/init.go b/app/vmalert/datasource/init.go index 72cfddfc99..7efd40693d 100644 --- a/app/vmalert/datasource/init.go +++ b/app/vmalert/datasource/init.go @@ -4,6 +4,7 @@ import ( "flag" "fmt" "net/http" + "net/url" "strings" "github.com/VictoriaMetrics/VictoriaMetrics/app/vmalert/utils" @@ -40,9 +41,9 @@ type Param struct { } // Init creates a Querier from provided flag values. -// Provided extraParams will be added as GET params to +// Provided extraParams will be added as GET params for // each request. -func Init(extraParams []Param) (QuerierBuilder, error) { +func Init(extraParams url.Values) (QuerierBuilder, error) { if *addr == "" { return nil, fmt.Errorf("datasource.url is empty") } @@ -56,11 +57,11 @@ func Init(extraParams []Param) (QuerierBuilder, error) { tr.MaxIdleConns = tr.MaxIdleConnsPerHost } + if extraParams == nil { + extraParams = url.Values{} + } if *roundDigits > 0 { - extraParams = append(extraParams, Param{ - Key: "round_digits", - Value: fmt.Sprintf("%d", *roundDigits), - }) + extraParams.Set("round_digits", fmt.Sprintf("%d", *roundDigits)) } authCfg, err := utils.AuthConfig(*basicAuthUsername, *basicAuthPassword, *basicAuthPasswordFile, *bearerToken, *bearerTokenFile) diff --git a/app/vmalert/datasource/vm.go b/app/vmalert/datasource/vm.go index c900ed2f63..c30eed93a2 100644 --- a/app/vmalert/datasource/vm.go +++ b/app/vmalert/datasource/vm.go @@ -5,6 +5,7 @@ import ( "fmt" "io/ioutil" "net/http" + "net/url" "strings" "time" @@ -22,8 +23,7 @@ type VMStorage struct { dataSourceType Type evaluationInterval time.Duration - extraLabels []string - extraParams []Param + extraParams url.Values disablePathAppend bool } @@ -47,9 +47,7 @@ func (s *VMStorage) ApplyParams(params QuerierParams) *VMStorage { s.dataSourceType = *params.DataSourceType } s.evaluationInterval = params.EvaluationInterval - for k, v := range params.ExtraLabels { - s.extraLabels = append(s.extraLabels, fmt.Sprintf("%s=%s", k, v)) - } + s.extraParams = params.QueryParams return s } diff --git a/app/vmalert/datasource/vm_graphite_api.go b/app/vmalert/datasource/vm_graphite_api.go index 36b89e187e..e4576f7a49 100644 --- a/app/vmalert/datasource/vm_graphite_api.go +++ b/app/vmalert/datasource/vm_graphite_api.go @@ -54,6 +54,14 @@ func (s *VMStorage) setGraphiteReqParams(r *http.Request, query string, timestam } r.URL.Path += graphitePath q := r.URL.Query() + for k, vs := range s.extraParams { + if q.Has(k) { // extraParams are prior to params in URL + q.Del(k) + } + for _, v := range vs { + q.Add(k, v) + } + } q.Set("format", "json") q.Set("target", query) from := "-5min" diff --git a/app/vmalert/datasource/vm_prom_api.go b/app/vmalert/datasource/vm_prom_api.go index 2faba4d27e..47a34e9e64 100644 --- a/app/vmalert/datasource/vm_prom_api.go +++ b/app/vmalert/datasource/vm_prom_api.go @@ -150,6 +150,14 @@ func (s *VMStorage) setPrometheusRangeReqParams(r *http.Request, query string, s func (s *VMStorage) setPrometheusReqParams(r *http.Request, query string) { q := r.URL.Query() + for k, vs := range s.extraParams { + if q.Has(k) { // extraParams are prior to params in URL + q.Del(k) + } + for _, v := range vs { + q.Add(k, v) + } + } q.Set("query", query) if s.evaluationInterval > 0 { // set step as evaluationInterval by default @@ -159,11 +167,5 @@ func (s *VMStorage) setPrometheusReqParams(r *http.Request, query string) { // override step with user-specified value q.Set("step", s.queryStep.String()) } - for _, l := range s.extraLabels { - q.Add("extra_label", l) - } - for _, p := range s.extraParams { - q.Add(p.Key, p.Value) - } r.URL.RawQuery = q.Encode() } diff --git a/app/vmalert/datasource/vm_test.go b/app/vmalert/datasource/vm_test.go index 946cedfe71..068cb62776 100644 --- a/app/vmalert/datasource/vm_test.go +++ b/app/vmalert/datasource/vm_test.go @@ -5,6 +5,7 @@ import ( "fmt" "net/http" "net/http/httptest" + "net/url" "reflect" "strconv" "strings" @@ -440,10 +441,10 @@ func TestRequestParams(t *testing.T) { }, }, { - "round digits", + "prometheus extra params", false, &VMStorage{ - extraParams: []Param{{"round_digits", "10"}}, + extraParams: url.Values{"round_digits": {"10"}}, }, func(t *testing.T, r *http.Request) { exp := fmt.Sprintf("query=%s&round_digits=10&time=%d", query, timestamp.Unix()) @@ -451,45 +452,32 @@ func TestRequestParams(t *testing.T) { }, }, { - "extra labels", - false, - &VMStorage{ - extraLabels: []string{ - "env=prod", - "query=es=cape", - }, - }, - func(t *testing.T, r *http.Request) { - exp := fmt.Sprintf("extra_label=env%%3Dprod&extra_label=query%%3Des%%3Dcape&query=%s&time=%d", query, timestamp.Unix()) - checkEqualString(t, exp, r.URL.RawQuery) - }, - }, - { - "extra labels range", + "prometheus extra params range", true, &VMStorage{ - extraLabels: []string{ - "env=prod", - "query=es=cape", + extraParams: url.Values{ + "nocache": {"1"}, + "max_lookback": {"1h"}, }, }, func(t *testing.T, r *http.Request) { - exp := fmt.Sprintf("end=%d&extra_label=env%%3Dprod&extra_label=query%%3Des%%3Dcape&query=%s&start=%d", + exp := fmt.Sprintf("end=%d&max_lookback=1h&nocache=1&query=%s&start=%d", timestamp.Unix(), query, timestamp.Unix()) checkEqualString(t, exp, r.URL.RawQuery) }, }, { - "extra params", + "graphite extra params", false, &VMStorage{ - extraParams: []Param{ - {Key: "nocache", Value: "1"}, - {Key: "max_lookback", Value: "1h"}, + dataSourceType: NewGraphiteType(), + extraParams: url.Values{ + "nocache": {"1"}, + "max_lookback": {"1h"}, }, }, func(t *testing.T, r *http.Request) { - exp := fmt.Sprintf("max_lookback=1h&nocache=1&query=%s&time=%d", query, timestamp.Unix()) + exp := fmt.Sprintf("format=json&from=-5min&max_lookback=1h&nocache=1&target=%s&until=now", query) checkEqualString(t, exp, r.URL.RawQuery) }, }, @@ -519,7 +507,7 @@ func TestRequestParams(t *testing.T) { func checkEqualString(t *testing.T, exp, got string) { t.Helper() if got != exp { - t.Errorf("expected to get %q; got %q", exp, got) + t.Errorf("expected to get: \n%q; \ngot: \n%q", exp, got) } } diff --git a/app/vmalert/group.go b/app/vmalert/group.go index d77598eaee..45a10f0758 100644 --- a/app/vmalert/group.go +++ b/app/vmalert/group.go @@ -4,6 +4,7 @@ import ( "context" "fmt" "hash/fnv" + "net/url" "sync" "time" @@ -27,8 +28,8 @@ type Group struct { Concurrency int Checksum string - ExtraFilterLabels map[string]string - Labels map[string]string + Labels map[string]string + Params url.Values doneCh chan struct{} finishedCh chan struct{} @@ -71,14 +72,14 @@ func mergeLabels(groupName, ruleName string, set1, set2 map[string]string) map[s func newGroup(cfg config.Group, qb datasource.QuerierBuilder, defaultInterval time.Duration, labels map[string]string) *Group { g := &Group{ - Type: cfg.Type, - Name: cfg.Name, - File: cfg.File, - Interval: cfg.Interval.Duration(), - Concurrency: cfg.Concurrency, - Checksum: cfg.Checksum, - ExtraFilterLabels: cfg.ExtraFilterLabels, - Labels: cfg.Labels, + Type: cfg.Type, + Name: cfg.Name, + File: cfg.File, + Interval: cfg.Interval.Duration(), + Concurrency: cfg.Concurrency, + Checksum: cfg.Checksum, + Params: cfg.Params, + Labels: cfg.Labels, doneCh: make(chan struct{}), finishedCh: make(chan struct{}), @@ -198,7 +199,7 @@ func (g *Group) updateWith(newGroup *Group) error { // group.Start function g.Type = newGroup.Type g.Concurrency = newGroup.Concurrency - g.ExtraFilterLabels = newGroup.ExtraFilterLabels + g.Params = newGroup.Params g.Labels = newGroup.Labels g.Checksum = newGroup.Checksum g.Rules = newRules diff --git a/app/vmalert/main.go b/app/vmalert/main.go index e0ed4ce2d8..540ff27fff 100644 --- a/app/vmalert/main.go +++ b/app/vmalert/main.go @@ -104,8 +104,7 @@ func main() { } // prevent queries from caching and boundaries aligning // when querying VictoriaMetrics datasource. - noCache := datasource.Param{Key: "nocache", Value: "1"} - q, err := datasource.Init([]datasource.Param{noCache}) + q, err := datasource.Init(url.Values{"nocache": {"1"}}) if err != nil { logger.Fatalf("failed to init datasource: %s", err) } diff --git a/app/vmalert/manager.go b/app/vmalert/manager.go index dff4a5550a..9c2823cb7b 100644 --- a/app/vmalert/manager.go +++ b/app/vmalert/manager.go @@ -3,6 +3,8 @@ package main import ( "context" "fmt" + "net/url" + "sort" "sync" "github.com/VictoriaMetrics/VictoriaMetrics/app/vmalert/config" @@ -161,13 +163,13 @@ func (g *Group) toAPI() APIGroup { // encode as string to avoid rounding ID: fmt.Sprintf("%d", g.ID()), - Name: g.Name, - Type: g.Type.String(), - File: g.File, - Interval: g.Interval.String(), - Concurrency: g.Concurrency, - ExtraFilterLabels: g.ExtraFilterLabels, - Labels: g.Labels, + Name: g.Name, + Type: g.Type.String(), + File: g.File, + Interval: g.Interval.String(), + Concurrency: g.Concurrency, + Params: urlValuesToStrings(g.Params), + Labels: g.Labels, } for _, r := range g.Rules { switch v := r.(type) { @@ -179,3 +181,24 @@ func (g *Group) toAPI() APIGroup { } return ag } + +func urlValuesToStrings(values url.Values) []string { + if len(values) < 1 { + return nil + } + + keys := make([]string, 0, len(values)) + for k := range values { + keys = append(keys, k) + } + sort.Strings(keys) + + var res []string + for _, k := range keys { + params := values[k] + for _, v := range params { + res = append(res, fmt.Sprintf("%s=%s", k, v)) + } + } + return res +} diff --git a/app/vmalert/recording.go b/app/vmalert/recording.go index 32924d075e..94f7f241fb 100644 --- a/app/vmalert/recording.go +++ b/app/vmalert/recording.go @@ -70,7 +70,7 @@ func newRecordingRule(qb datasource.QuerierBuilder, group *Group, cfg config.Rul q: qb.BuildWithParams(datasource.QuerierParams{ DataSourceType: &group.Type, EvaluationInterval: group.Interval, - ExtraLabels: group.ExtraFilterLabels, + QueryParams: group.Params, }), } diff --git a/app/vmalert/web.qtpl b/app/vmalert/web.qtpl index c15fa9de8e..98e33c05f3 100644 --- a/app/vmalert/web.qtpl +++ b/app/vmalert/web.qtpl @@ -54,10 +54,10 @@ {% if rNotOk[g.Name] > 0 %}{%d rNotOk[g.Name] %} {% endif %} {%d rOk[g.Name] %}

{%s g.File %}

- {% if len(g.ExtraFilterLabels) > 0 %} -
Extra filter labels - {% for k, v := range g.ExtraFilterLabels %} - {%s k %}={%s v %} + {% if len(g.Params) > 0 %} +
Extra params + {% for _, param := range g.Params %} + {%s param %} {% endfor %}
{% endif %} diff --git a/app/vmalert/web.qtpl.go b/app/vmalert/web.qtpl.go index b642add0ab..27c829378f 100644 --- a/app/vmalert/web.qtpl.go +++ b/app/vmalert/web.qtpl.go @@ -211,22 +211,18 @@ func StreamListGroups(qw422016 *qt422016.Writer, groups []APIGroup) { qw422016.N().S(`

`) //line app/vmalert/web.qtpl:57 - if len(g.ExtraFilterLabels) > 0 { + if len(g.Params) > 0 { //line app/vmalert/web.qtpl:57 qw422016.N().S(` -
Extra filter labels +
Extra params `) //line app/vmalert/web.qtpl:59 - for k, v := range g.ExtraFilterLabels { + for _, param := range g.Params { //line app/vmalert/web.qtpl:59 qw422016.N().S(` `) //line app/vmalert/web.qtpl:60 - qw422016.E().S(k) -//line app/vmalert/web.qtpl:60 - qw422016.N().S(`=`) -//line app/vmalert/web.qtpl:60 - qw422016.E().S(v) + qw422016.E().S(param) //line app/vmalert/web.qtpl:60 qw422016.N().S(` `) diff --git a/app/vmalert/web_types.go b/app/vmalert/web_types.go index cb13fb23f1..c49c81b659 100644 --- a/app/vmalert/web_types.go +++ b/app/vmalert/web_types.go @@ -23,16 +23,16 @@ type APIAlert struct { // APIGroup represents Group for WEB view type APIGroup struct { - Name string `json:"name"` - Type string `json:"type"` - ID string `json:"id"` - File string `json:"file"` - Interval string `json:"interval"` - Concurrency int `json:"concurrency"` - ExtraFilterLabels map[string]string `json:"extra_filter_labels"` - Labels map[string]string `json:"labels,omitempty"` - AlertingRules []APIAlertingRule `json:"alerting_rules"` - RecordingRules []APIRecordingRule `json:"recording_rules"` + Name string `json:"name"` + Type string `json:"type"` + ID string `json:"id"` + File string `json:"file"` + Interval string `json:"interval"` + Concurrency int `json:"concurrency"` + Params []string `json:"params"` + Labels map[string]string `json:"labels,omitempty"` + AlertingRules []APIAlertingRule `json:"alerting_rules"` + RecordingRules []APIRecordingRule `json:"recording_rules"` } // APIAlertingRule represents AlertingRule for WEB view