vmalert: remove deprecated in v1.61.0 -rule.configCheckInterval (#4745)

Use `-configCheckInterval` command-line flag instead.

Signed-off-by: hagen1778 <roman@victoriametrics.com>
This commit is contained in:
Roman Khavronenko 2023-07-31 16:39:57 +02:00 committed by Aliaksandr Valialkin
parent 9d4c838412
commit 85eb62a2ec
No known key found for this signature in database
GPG key ID: A72BEC6CD3D0DED1
5 changed files with 6 additions and 16 deletions

View file

@ -1243,8 +1243,6 @@ The shortlist of configuration flags is the following:
See https://docs.victoriametrics.com/vmalert.html#reading-rules-from-object-storage See https://docs.victoriametrics.com/vmalert.html#reading-rules-from-object-storage
Supports an array of values separated by comma or specified via multiple flags. Supports an array of values separated by comma or specified via multiple flags.
-rule.configCheckInterval duration
Interval for checking for changes in '-rule' files. By default, the checking is disabled. Send SIGHUP signal in order to force config check for changes. DEPRECATED - see '-configCheckInterval' instead
-rule.maxResolveDuration duration -rule.maxResolveDuration duration
Limits the maximum duration for automatic alert expiration, which by default is 4 times evaluationInterval of the parent group. Limits the maximum duration for automatic alert expiration, which by default is 4 times evaluationInterval of the parent group.
-rule.resendDelay duration -rule.resendDelay duration

View file

@ -55,9 +55,6 @@ absolute path to all .tpl files in root.
-rule.templates="dir/**/*.tpl". Includes all the .tpl files in "dir" subfolders recursively. -rule.templates="dir/**/*.tpl". Includes all the .tpl files in "dir" subfolders recursively.
`) `)
rulesCheckInterval = flag.Duration("rule.configCheckInterval", 0, "Interval for checking for changes in '-rule' files. "+
"By default, the checking is disabled. Send SIGHUP signal in order to force config check for changes. DEPRECATED - see '-configCheckInterval' instead")
configCheckInterval = flag.Duration("configCheckInterval", 0, "Interval for checking for changes in '-rule' or '-notifier.config' files. "+ configCheckInterval = flag.Duration("configCheckInterval", 0, "Interval for checking for changes in '-rule' or '-notifier.config' files. "+
"By default, the checking is disabled. Send SIGHUP signal in order to force config check for changes.") "By default, the checking is disabled. Send SIGHUP signal in order to force config check for changes.")
@ -311,10 +308,6 @@ See the docs at https://docs.victoriametrics.com/vmalert.html .
func configReload(ctx context.Context, m *manager, groupsCfg []config.Group, sighupCh <-chan os.Signal) { func configReload(ctx context.Context, m *manager, groupsCfg []config.Group, sighupCh <-chan os.Signal) {
var configCheckCh <-chan time.Time var configCheckCh <-chan time.Time
checkInterval := *configCheckInterval checkInterval := *configCheckInterval
if checkInterval == 0 && *rulesCheckInterval > 0 {
logger.Warnf("flag `rule.configCheckInterval` is deprecated - use `configCheckInterval` instead")
checkInterval = *rulesCheckInterval
}
if checkInterval > 0 { if checkInterval > 0 {
ticker := time.NewTicker(checkInterval) ticker := time.NewTicker(checkInterval)
configCheckCh = ticker.C configCheckCh = ticker.C

View file

@ -92,7 +92,7 @@ groups:
} }
writeToFile(t, f.Name(), rules1) writeToFile(t, f.Name(), rules1)
*rulesCheckInterval = 200 * time.Millisecond *configCheckInterval = 200 * time.Millisecond
*rulePath = []string{f.Name()} *rulePath = []string{f.Name()}
ctx, cancel := context.WithCancel(context.Background()) ctx, cancel := context.WithCancel(context.Background())
@ -117,14 +117,14 @@ groups:
return len(m.groups) return len(m.groups)
} }
time.Sleep(*rulesCheckInterval * 2) time.Sleep(*configCheckInterval * 2)
groupsLen := lenLocked(m) groupsLen := lenLocked(m)
if groupsLen != 1 { if groupsLen != 1 {
t.Fatalf("expected to have exactly 1 group loaded; got %d", groupsLen) t.Fatalf("expected to have exactly 1 group loaded; got %d", groupsLen)
} }
writeToFile(t, f.Name(), rules2) writeToFile(t, f.Name(), rules2)
time.Sleep(*rulesCheckInterval * 2) time.Sleep(*configCheckInterval * 2)
groupsLen = lenLocked(m) groupsLen = lenLocked(m)
if groupsLen != 2 { if groupsLen != 2 {
fmt.Println(m.groups) fmt.Println(m.groups)
@ -133,7 +133,7 @@ groups:
writeToFile(t, f.Name(), rules1) writeToFile(t, f.Name(), rules1)
procutil.SelfSIGHUP() procutil.SelfSIGHUP()
time.Sleep(*rulesCheckInterval / 2) time.Sleep(*configCheckInterval / 2)
groupsLen = lenLocked(m) groupsLen = lenLocked(m)
if groupsLen != 1 { if groupsLen != 1 {
t.Fatalf("expected to have exactly 1 group loaded; got %d", groupsLen) t.Fatalf("expected to have exactly 1 group loaded; got %d", groupsLen)
@ -141,7 +141,7 @@ groups:
writeToFile(t, f.Name(), `corrupted`) writeToFile(t, f.Name(), `corrupted`)
procutil.SelfSIGHUP() procutil.SelfSIGHUP()
time.Sleep(*rulesCheckInterval / 2) time.Sleep(*configCheckInterval / 2)
groupsLen = lenLocked(m) groupsLen = lenLocked(m)
if groupsLen != 1 { // should remain unchanged if groupsLen != 1 { // should remain unchanged
t.Fatalf("expected to have exactly 1 group loaded; got %d", groupsLen) t.Fatalf("expected to have exactly 1 group loaded; got %d", groupsLen)

View file

@ -25,6 +25,7 @@ The following `tip` changes can be tested by building VictoriaMetrics components
## tip ## tip
* FEATURE: [MetricsQL](https://docs.victoriametrics.com/MetricsQL.html): add `share_eq_over_time(m[d], eq)` function for calculating the share (in the range `[0...1]`) of raw samples on the given lookbehind window `d`, which are equal to `eq`. See [this feature request](https://github.com/VictoriaMetrics/VictoriaMetrics/issues/4441). Thanks to @Damon07 for the [pull request](https://github.com/VictoriaMetrics/VictoriaMetrics/pull/4725). * FEATURE: [MetricsQL](https://docs.victoriametrics.com/MetricsQL.html): add `share_eq_over_time(m[d], eq)` function for calculating the share (in the range `[0...1]`) of raw samples on the given lookbehind window `d`, which are equal to `eq`. See [this feature request](https://github.com/VictoriaMetrics/VictoriaMetrics/issues/4441). Thanks to @Damon07 for the [pull request](https://github.com/VictoriaMetrics/VictoriaMetrics/pull/4725).
* FEATURE: [vmalert](https://docs.victoriametrics.com/vmalert.html): remove deprecated in [v1.61.0](https://github.com/VictoriaMetrics/VictoriaMetrics/releases/tag/v1.61.0) `-rule.configCheckInterval` command-line flag. Use `-configCheckInterval` command-line flag instead.
* BUGFIX: [vmagent](https://docs.victoriametrics.com/vmagent.html): use local scrape timestamps for the scraped metrics unless `honor_timestamps: true` option is explicitly set at [scrape_config](https://docs.victoriametrics.com/sd_configs.html#scrape_configs). This fixes gaps for metrics collected from [cadvisor](https://github.com/google/cadvisor) or similar exporters, which export metrics with invalid timestamps. See [this issue](https://github.com/VictoriaMetrics/VictoriaMetrics/issues/4697) and [this comment](https://github.com/VictoriaMetrics/VictoriaMetrics/issues/4697#issuecomment-1654614799) for details. The issue has been introduced in [v1.68.0](#v1680). * BUGFIX: [vmagent](https://docs.victoriametrics.com/vmagent.html): use local scrape timestamps for the scraped metrics unless `honor_timestamps: true` option is explicitly set at [scrape_config](https://docs.victoriametrics.com/sd_configs.html#scrape_configs). This fixes gaps for metrics collected from [cadvisor](https://github.com/google/cadvisor) or similar exporters, which export metrics with invalid timestamps. See [this issue](https://github.com/VictoriaMetrics/VictoriaMetrics/issues/4697) and [this comment](https://github.com/VictoriaMetrics/VictoriaMetrics/issues/4697#issuecomment-1654614799) for details. The issue has been introduced in [v1.68.0](#v1680).

View file

@ -1254,8 +1254,6 @@ The shortlist of configuration flags is the following:
See https://docs.victoriametrics.com/vmalert.html#reading-rules-from-object-storage See https://docs.victoriametrics.com/vmalert.html#reading-rules-from-object-storage
Supports an array of values separated by comma or specified via multiple flags. Supports an array of values separated by comma or specified via multiple flags.
-rule.configCheckInterval duration
Interval for checking for changes in '-rule' files. By default, the checking is disabled. Send SIGHUP signal in order to force config check for changes. DEPRECATED - see '-configCheckInterval' instead
-rule.maxResolveDuration duration -rule.maxResolveDuration duration
Limits the maximum duration for automatic alert expiration, which by default is 4 times evaluationInterval of the parent group. Limits the maximum duration for automatic alert expiration, which by default is 4 times evaluationInterval of the parent group.
-rule.resendDelay duration -rule.resendDelay duration