]> git.ipfire.org Git - thirdparty/haproxy.git/commitdiff
MEDIUM: stats: include disabled proxies that hold active sessions to stats
authorMarno Krahmer <marno.krahmer@new-work.se>
Thu, 24 Jun 2021 14:51:08 +0000 (16:51 +0200)
committerWilly Tarreau <w@1wt.eu>
Tue, 6 Jul 2021 09:54:08 +0000 (11:54 +0200)
After reloading HAProxy, the old process may still hold active sessions.
Currently there is no way to gather information, how many sessions such
a process still holds. This patch will not exclude disabled proxies from
stats output when they hold at least one active session. This will allow
sending `!@<PID> show stat` through a master socket to the disabled
process and have it returning its stats data.

src/stats.c

index 3458924b786fef8546cc155822635c3db723bf7a..4b4f28daf2264fc2c52cf16a08f66b7b037cbe45 100644 (file)
@@ -3575,8 +3575,11 @@ static int stats_dump_proxies(struct stream_interface *si,
                }
 
                px = appctx->ctx.stats.obj1;
-               /* skip the disabled proxies, global frontend and non-networked ones */
-               if (!px->disabled && px->uuid > 0 && (px->cap & (PR_CAP_FE | PR_CAP_BE))) {
+               /* Skip the global frontend proxies and non-networked ones.
+                * Also skip disabled proxies unless they are still holding active sessions.
+                * This change allows retrieving stats from "old" proxies after a reload.
+                */
+               if ((!px->disabled || px->served > 0) && px->uuid > 0 && (px->cap & (PR_CAP_FE | PR_CAP_BE))) {
                        if (stats_dump_proxy_to_buffer(si, htx, px, uri) == 0)
                                return 0;
                }