Bug 1896167 - HAProxyReloadFail alert only briefly fires in the event of a broken HAProxy config
Summary: HAProxyReloadFail alert only briefly fires in the event of a broken HAProxy c...
Keywords:
Status: CLOSED ERRATA
Alias: None
Product: OpenShift Container Platform
Classification: Red Hat
Component: Routing
Version: 4.7
Hardware: Unspecified
OS: Unspecified
high
medium
Target Milestone: ---
: 4.6.z
Assignee: Stephen Greene
QA Contact: Arvind iyengar
URL:
Whiteboard:
Depends On: 1892338
Blocks: 1896168
TreeView+ depends on / blocked
 
Reported: 2020-11-09 21:15 UTC by OpenShift BugZilla Robot
Modified: 2021-02-22 13:54 UTC (History)
4 users (show)

Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Cause: OpenShift router creates an invalid HAProxy config that causes router reloads to fail. Consequence: HAProxyReloadFail prometheus alert only fires for a span of ~5 minutes, regardless of the actual duration of the reload outage. Fix: Replace the router template_router_reload_fails counter metric with the new template_router_reload_failure gauge metric. Change the HAProxyReloadFail alert to fire based on the boolean status of the template_router_reload_failure metric. Result: The HAProxyReloadFail metric fires for the entire time that HAProxy reloads are failing.
Clone Of:
Environment:
Last Closed: 2021-02-22 13:54:32 UTC
Target Upstream Version:


Attachments (Terms of Use)


Links
System ID Private Priority Status Summary Last Updated
Github openshift cluster-ingress-operator pull 486 0 None closed [release-4.6] Bug 1896167: Back port HAProxy reload failures alert fix 2021-02-15 03:14:26 UTC
Github openshift router pull 215 0 None closed [release-4.6] Bug 1896167: metrics: Rework template_router_reload_failure metric 2021-02-15 03:14:27 UTC
Red Hat Product Errata RHBA-2021:0510 0 None None None 2021-02-22 13:54:49 UTC

Description OpenShift BugZilla Robot 2020-11-09 21:15:06 UTC
+++ This bug was initially created as a clone of Bug #1892338 +++

If a route were to break the HAProxy config files, and thus break HAProxy reloads, the HAProxyReloadFail alert will only fire for ~5 minutes. 

Instead, the HAProxyReloadFail alert (& base metric) should be reworked.

The template_router_reload_fails metric should be dropped in exchange for a metric that tracks the status of the most recent reload. ie template_router_reload_success which is pinned to 1 on successful reloads, and 0 on failed reloads. The current template_router_reload_fails reports an increasing value of failed reloads, which is difficult to alert on properly. A flag/boolean metric is trivial to alert on for the actual duration of the problem.

This affects 4.7, 4.6, and 4.5, so backports will be required.

--- Additional comment from wking@redhat.com on 2020-10-28 14:09:57 UTC ---

I'd mentioned a positive name, but a negative name like template_router_reload_failure might be more convenient if you wanted a label with a reason slug, or some such.  You could always add a reason to a positive label too, but template_router_reload_success{failure_reason="whatever"} feels more awkward than template_router_reload_failure{reason="whatever"}.

--- Additional comment from sgreene@redhat.com on 2020-10-28 14:17:23 UTC ---

(In reply to W. Trevor King from comment #1)
> I'd mentioned a positive name, but a negative name like
> template_router_reload_failure might be more convenient if you wanted a
> label with a reason slug, or some such.  You could always add a reason to a
> positive label too, but
> template_router_reload_success{failure_reason="whatever"} feels more awkward
> than template_router_reload_failure{reason="whatever"}.

Noted, I will make sure to use a negative name instead. :)

--- Additional comment from wking@redhat.com on 2020-10-28 15:32:44 UTC ---

Not a regression, so it's hard to imagine holding 4.7.0 on a fix for this.

Comment 2 Stephen Greene 2020-12-03 16:36:05 UTC
https://github.com/openshift/router/pull/215 is awaiting cherry pick approval. Adding upcoming sprint.

Comment 4 Arvind iyengar 2021-02-15 08:42:02 UTC
Tested in "4.6.0-0.nightly-2021-02-12-073026" payload. It is noted that the new metric and the associated Prometheus rules are added as intended:
------
$ oc get clusterversion
NAME      VERSION                             AVAILABLE   PROGRESSING   SINCE   STATUS
version   4.6.0-0.nightly-2021-02-12-073026   True        False         82m     Cluster version is 4.6.0-0.nightly-2021-02-12-073026
    
        
sh-4.4$ curl -sS -H "Authorization: Bearer eyJhbGciOiJSUzI1NiIsImtpZCI6IlhveEtZSlVxMVRHaDBSXzdjWnB6N29uRVRRYVFZZkhxVFJvd2k1VmJidE0ifQ.eyJpc3MiOiJrdWJlcm5ldGVzL3NlcnZpY2VhY2NvdW50Iiwia3ViZXJuZXRlcy5pby9zZXJ2aWNlYWNjb3VudC9uYW1lc3BhY2UiOiJvcGVuc2hpZnQtbW9uaXRvcmluZyIsImt1YmVybmV0ZXMuaW8vc2VydmljZWFjY291bnQvc2VjcmV0Lm5hbWUiOiJwcm9tZXRoZXVzLWs4cy10b2tlbi1jYnJydCIsImt1YmVybmV0ZXMuaW8vc2VydmljZWFjY291bnQvc2VydmljZS1hY2NvdW50Lm5hbWUiOiJwcm9tZXRoZXVzLWs4cyIsImt1YmVybmV0ZXMuaW8vc2VydmljZWFjY291bnQvc2VydmljZS1hY2NvdW50LnVpZCI6IjE3MDIyMjI3LWJiYTItNGMzMy1iZTJkLWI4YjYyNzk2YWVhNyIsInN1YiI6InN5c3RlbTpzZXJ2aWNlYWNjb3VudDpvcGVuc2hpZnQtbW9uaXRvcmluZzpwcm9tZXRoZXVzLWs4cyJ9.UluCiF8LutNV9HwChztozfrVFfNvJsssDS3sHFNz58bFlN7jiY3-jZdkwa99DyNPTvyQIMH8gUcDMSgRMuEzJnfoGQDoFiR5YQUZh_BQ7ILnj0x-vcA-_py2E22drCgt5dDzQxuRZFMA22ZisWJg68Faoa0ryrcawHSoQG8MaHzbnnf339jAkOVOKX6qN4GneHKNVB1ob1-5YDOOIrRKHzc1YF4JyNYfbnJLnPFt6oq9c2bazxmXvjJsFOGRvEX4LhrDMCOKTOUt7ci4QOq8VNHP2HSlLmN9huyjAJKW-FrbXqPeq7PQ8mNq_AMPutCnEI8VE7aPuHc7KOjRM1jZNg" -k https://10.131.0.7:1936/metrics | grep -i template_router_reload_failure
# HELP template_router_reload_failure Metric to track the status of the most recent HAProxy reload
# TYPE template_router_reload_failure gauge
template_router_reload_failure 0
------

Comment 7 errata-xmlrpc 2021-02-22 13:54:32 UTC
Since the problem described in this bug report should be
resolved in a recent advisory, it has been closed with a
resolution of ERRATA.

For information on the advisory (OpenShift Container Platform 4.6.18 bug fix update), and where to find the updated
files, follow the link below.

If the solution does not work for you, open a new bug report.

https://access.redhat.com/errata/RHBA-2021:0510


Note You need to log in before you can comment on or make changes to this bug.