mirror of
https://github.com/VictoriaMetrics/VictoriaMetrics.git
synced 2024-11-23 20:37:12 +01:00
app/vmalert: remove unnecessary omitempty
tag for interval
param (#1649)
`omitempty` tag resulted into skipping this param on marshaling, which was used as a checksum for groups configuration. Since on config reload checksums are compared before applying changes, any change to `interval` only didn't trigger config reload. https://github.com/VictoriaMetrics/VictoriaMetrics/issues/1641 Signed-off-by: hagen1778 <roman@victoriametrics.com>
This commit is contained in:
parent
6f061dab19
commit
0e35fc9538
@ -24,7 +24,7 @@ type Group struct {
|
||||
Type datasource.Type `yaml:"type,omitempty"`
|
||||
File string
|
||||
Name string `yaml:"name"`
|
||||
Interval utils.PromDuration `yaml:"interval,omitempty"`
|
||||
Interval utils.PromDuration `yaml:"interval"`
|
||||
Rules []Rule `yaml:"rules"`
|
||||
Concurrency int `yaml:"concurrency"`
|
||||
// ExtraFilterLabels is a list label filters applied to every rule
|
||||
|
@ -436,7 +436,7 @@ rules:
|
||||
`)
|
||||
})
|
||||
|
||||
t.Run("Ok, `for` must change cs", func(t *testing.T) {
|
||||
t.Run("`for` change", func(t *testing.T) {
|
||||
f(t, `
|
||||
name: TestGroup
|
||||
rules:
|
||||
@ -450,5 +450,34 @@ rules:
|
||||
expr: sum by(job) (up == 1)
|
||||
`)
|
||||
})
|
||||
|
||||
t.Run("`interval` change", func(t *testing.T) {
|
||||
f(t, `
|
||||
name: TestGroup
|
||||
interval: 2s
|
||||
rules:
|
||||
- alert: ExampleAlertWithFor
|
||||
expr: sum by(job) (up == 1)
|
||||
`, `
|
||||
name: TestGroup
|
||||
interval: 4s
|
||||
rules:
|
||||
- alert: ExampleAlertWithFor
|
||||
expr: sum by(job) (up == 1)
|
||||
`)
|
||||
})
|
||||
t.Run("`concurrency` change", func(t *testing.T) {
|
||||
f(t, `
|
||||
name: TestGroup
|
||||
concurrency: 2
|
||||
rules:
|
||||
- alert: ExampleAlertWithFor
|
||||
expr: sum by(job) (up == 1)
|
||||
`, `
|
||||
name: TestGroup
|
||||
concurrency: 16
|
||||
rules:
|
||||
- alert: ExampleAlertWithFor
|
||||
expr: sum by(job) (up == 1)
|
||||
`)
|
||||
})
|
||||
}
|
||||
|
@ -190,6 +190,9 @@ func (g *Group) updateWith(newGroup *Group) error {
|
||||
for _, nr := range rulesRegistry {
|
||||
newRules = append(newRules, nr)
|
||||
}
|
||||
// note that g.Interval is not updated here
|
||||
// so the value can be compared later in
|
||||
// group.Start function
|
||||
g.Type = newGroup.Type
|
||||
g.Concurrency = newGroup.Concurrency
|
||||
g.ExtraFilterLabels = newGroup.ExtraFilterLabels
|
||||
|
Loading…
Reference in New Issue
Block a user