]> git.ipfire.org Git - thirdparty/haproxy.git/commitdiff
BUG/MINOR: promex: fix backend_agg_check_status
authorCedric Paillet <c.paillet@criteo.com>
Tue, 12 Sep 2023 09:37:55 +0000 (09:37 +0000)
committerChristopher Faulet <cfaulet@haproxy.com>
Tue, 12 Sep 2023 17:50:17 +0000 (19:50 +0200)
When a server is in maintenance, the check.status is no longer updated.
Therefore, we shouldn't consider check.status if the checks are not active. This
check was properly implemented in the haproxy_server_check_status metric, but
wasn't carried over to backend_agg_check_status, which introduced
inconsistencies between the two metrics.

[cf: This patch must be backported as far as 2.4]

addons/promex/service-prometheus.c

index e02e8c0c78e432ee07d520a1c63c24d96b81e86f..6885d202e512d71698b2be3f4fde3e9fac0441da 100644 (file)
@@ -863,8 +863,10 @@ static int promex_dump_back_metrics(struct appctx *appctx, struct htx *htx)
                                                goto next_px;
                                        sv = px->srv;
                                        while (sv) {
-                                               srv_check_status = sv->check.status;
-                                               srv_check_count[srv_check_status] += 1;
+                                               if ((sv->check.state & (CHK_ST_ENABLED|CHK_ST_PAUSED)) == CHK_ST_ENABLED) {
+                                                       srv_check_status = sv->check.status;
+                                                       srv_check_count[srv_check_status] += 1;
+                                               }
                                                sv = sv->next;
                                        }
                                        for (; ctx->obj_state < HCHK_STATUS_SIZE; ctx->obj_state++) {