From 40fcf667b067243d4d7f71f844b9987bc36bbc9f Mon Sep 17 00:00:00 2001 From: Roman Khavronenko Date: Tue, 30 Nov 2021 01:23:49 +0200 Subject: [PATCH] vmalert: continue to print errors for bad config during hot reload (#1871) Previously, vmalert would print an err message and set vmalert_config_last_reload_successful=0 only once during a hot reload of a bad config. Such behaviour may result into non noticed event of a bad config reload attempt Now, it continues to print error messages and keep vmalert_config_last_reload_successful state until successful attempt will be made or config state will be rolled back to prev state. Signed-off-by: hagen1778 --- app/vmalert/main.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/app/vmalert/main.go b/app/vmalert/main.go index 775f756b2e..e0ed4ce2d8 100644 --- a/app/vmalert/main.go +++ b/app/vmalert/main.go @@ -284,13 +284,13 @@ func configReload(ctx context.Context, m *manager, groupsCfg []config.Group, sig // config didn't change - skip it continue } - groupsCfg = newGroupsCfg - if err := m.update(ctx, groupsCfg, false); err != nil { + if err := m.update(ctx, newGroupsCfg, false); err != nil { configReloadErrors.Inc() configSuccess.Set(0) logger.Errorf("error while reloading rules: %s", err) continue } + groupsCfg = newGroupsCfg configSuccess.Set(1) configTimestamp.Set(fasttime.UnixTimestamp()) logger.Infof("Rules reloaded successfully from %q", *rulePath)