Skip to content

Commit 173feac

Browse files
hdurand0710Gopher Bot
authored andcommitted
BUG/MEDIUM: fix reloads Prometheus metrics for success and failure
The wrong error was used to distinguish between success and failure for the reload metrics. This was tracking the success or failure of the haproxy configuration file commit, not the reload status.
1 parent c04f0ba commit 173feac

1 file changed

Lines changed: 2 additions & 1 deletion

File tree

pkg/controller/controller.go

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -202,6 +202,7 @@ func (c *HAProxyController) updateHAProxy() {
202202
var msg string
203203
if msg, err = c.haproxy.Service("reload"); err != nil {
204204
logger.Error(err)
205+
c.prometheusMetricsManager.UpdateReloadMetrics(err)
205206
errLines := strings.Split(msg, "\n")
206207
msg := ""
207208
// Extract only lines with [ALERT] prefix to reuse functions
@@ -227,8 +228,8 @@ func (c *HAProxyController) updateHAProxy() {
227228
logger.Error(c.haproxy.PopPreviousBackends())
228229
} else {
229230
logger.Info("HAProxy reloaded")
231+
c.prometheusMetricsManager.UpdateReloadMetrics(err)
230232
}
231-
c.prometheusMetricsManager.UpdateReloadMetrics(err)
232233
} else if c.osArgs.DisableDelayedWritingOnlyIfReload {
233234
// If the osArgs flag is set, then write the files to disk even if there is no reload of haproxy
234235
fs.RunDelayedFuncs()

0 commit comments

Comments
 (0)