From: Amaury Denoyelle Date: Thu, 4 Apr 2024 16:15:42 +0000 (+0200) Subject: BUG/MINOR: stats: fix stot metric for listeners X-Git-Tag: v3.0-dev9~81 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=282a8e9f52d214ec834001265a693ef6e850dd98;p=thirdparty%2Fhaproxy.git BUG/MINOR: stats: fix stot metric for listeners This commit is part of a series to align counters usage between frontends/listeners on one side and backends/servers on the other. On frontend side, "stot" is the total count of sessions for both proxies and listeners. For proxies, fe_counters is correctely used. The bug is on listeners where value is returned, which instead indicates a number of connection. This commit fixes this by returning counter value for "stot" metric. Along this fixes, use the opportunity to report "conn_tot" for listeners using value, as for frontend proxies. This commit fixes a bug but must not be backported as stats output is changed. --- diff --git a/src/stats.c b/src/stats.c index 3c44afe663..5d7dc1a95e 100644 --- a/src/stats.c +++ b/src/stats.c @@ -907,7 +907,7 @@ int stats_fill_li_stats(struct proxy *px, struct listener *l, int flags, metric = mkf_u32(FO_CONFIG|FN_LIMIT, l->bind_conf->maxconn); break; case ST_F_STOT: - metric = mkf_u64(FN_COUNTER, l->counters->cum_conn); + metric = mkf_u64(FN_COUNTER, l->counters->cum_sess); break; case ST_F_BIN: metric = mkf_u64(FN_COUNTER, l->counters->bytes_in); @@ -945,6 +945,9 @@ int stats_fill_li_stats(struct proxy *px, struct listener *l, int flags, case ST_F_TYPE: metric = mkf_u32(FO_CONFIG|FS_SERVICE, STATS_TYPE_SO); break; + case ST_F_CONN_TOT: + metric = mkf_u64(FN_COUNTER, l->counters->cum_conn); + break; case ST_F_WREW: metric = mkf_u64(FN_COUNTER, l->counters->failed_rewrites); break;