From fac1de935abdc5968ba9f5dcdf1c774b903aae37 Mon Sep 17 00:00:00 2001 From: Amaury Denoyelle Date: Thu, 28 Aug 2025 18:14:23 +0200 Subject: [PATCH] MINOR: stats: display new curr_sess_idle_conns server counter Add a new stats column in proxy stats to display server counter for private idle connections. This counter has been introduced recently. The value is displayed on CSV output on the last column before modules. It is also displayed on HTLM page alongside other idle server counters. --- doc/management.txt | 1 + src/stats-html.c | 2 ++ src/stats-proxy.c | 4 ++++ 3 files changed, 7 insertions(+) diff --git a/doc/management.txt b/doc/management.txt index 945aef8f4..3766b6f63 100644 --- a/doc/management.txt +++ b/doc/management.txt @@ -1356,6 +1356,7 @@ Here is the list of static fields using the proxy statistics domain: 111. h3req [.F..]: total number of HTTP/3 sessions processed by this object since the worker process started 112. proto [L...]: protocol + 113. priv_idle_cur [...S]: current number of private idle connections For all other statistics domains, the presence or the order of the fields are not guaranteed. In this case, the header line should always be used to parse diff --git a/src/stats-html.c b/src/stats-html.c index e533535a8..b18d64195 100644 --- a/src/stats-html.c +++ b/src/stats-html.c @@ -887,6 +887,7 @@ int stats_dump_fields_html(struct buffer *out, "- unsafe:%s" "- safe:%s" "Estimated need of connections:%s" + "Private idle connections:%s" "Active connections limit:%s" "Idle connections limit:%s" "" @@ -901,6 +902,7 @@ int stats_dump_fields_html(struct buffer *out, U2H(stats[ST_I_PX_IDLE_CONN_CUR].u.u32), U2H(stats[ST_I_PX_SAFE_CONN_CUR].u.u32), U2H(stats[ST_I_PX_NEED_CONN_EST].u.u32), + U2H(stats[ST_I_PX_PRIV_IDLE_CUR].u.u32), LIM2A(stats[ST_I_PX_SLIM].u.u32, "-"), stats[ST_I_PX_SRV_ILIM].type ? U2H(stats[ST_I_PX_SRV_ILIM].u.u32) : "-", diff --git a/src/stats-proxy.c b/src/stats-proxy.c index 03a19e528..81d3fb43a 100644 --- a/src/stats-proxy.c +++ b/src/stats-proxy.c @@ -191,6 +191,7 @@ const struct stat_col stat_cols_px[ST_I_PX_MAX] = { [ST_I_PX_H2REQ] = ME_NEW_FE_SHARED("h2req", NULL, FN_COUNTER, FF_U64, p.http.cum_req[2], STATS_PX_CAP__F__, "Total number of hTTP/2 sessions processed by this object since the worker process started"), [ST_I_PX_H3REQ] = ME_NEW_FE_SHARED("h3req", NULL, FN_COUNTER, FF_U64, p.http.cum_req[3], STATS_PX_CAP__F__, "Total number of HTTP/3 sessions processed by this object since the worker process started"), [ST_I_PX_PROTO] = { .name = "proto", .alt_name = NULL, .desc = "Protocol" }, + [ST_I_PX_PRIV_IDLE_CUR] = { .name = "priv_idle_cur", .alt_name = "private_idle_connections_current",.desc = "Current number of private idle connections", .cap = STATS_PX_CAP____S}, }; /* Returns true if column at should be hidden. @@ -1089,6 +1090,9 @@ int stats_fill_sv_line(struct proxy *px, struct server *sv, int flags, if (flags & STAT_F_SHLGNDS && sv->cookie) field = mkf_str(FO_CONFIG|FN_NAME|FS_SERVICE, sv->cookie); break; + case ST_I_PX_PRIV_IDLE_CUR: + field = mkf_u32(0, sv->curr_sess_idle_conns); + break; default: /* not used for servers. If a specific field * is requested, return an error. Otherwise continue.