From: Christopher Faulet Date: Tue, 4 Nov 2025 18:00:43 +0000 (+0100) Subject: MINOR: counters: Remove bytes_in and bytes_out counter from fe/be/srv/li X-Git-Tag: v3.3-dev12~27 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=0084baa6ba664cdf392132b5c7e0eccc71129f07;p=thirdparty%2Fhaproxy.git MINOR: counters: Remove bytes_in and bytes_out counter from fe/be/srv/li bytes_in and bytes_out counters per frontend, backend, listener and server were removed and we now rely on, respectively on, req_in and res_in counters. This patch is related to issue #1617. --- diff --git a/include/haproxy/counters-t.h b/include/haproxy/counters-t.h index 4966197e9..2cdb4582b 100644 --- a/include/haproxy/counters-t.h +++ b/include/haproxy/counters-t.h @@ -49,8 +49,6 @@ long long req_out; /* number of bytes sent to the server */\ long long res_in; /* number of bytes received from the server */\ long long res_out; /* number of bytes sent to the client */\ - long long bytes_out; /* number of bytes transferred from the server to the client */\ - long long bytes_in; /* number of bytes transferred from the client to the server */\ long long denied_resp; /* blocked responses because of security concerns */\ long long denied_req; /* blocked requests because of security concerns */\ long long cum_sess; /* cumulated number of accepted connections */\ diff --git a/src/stats-proxy.c b/src/stats-proxy.c index bc1b6750c..a7094653c 100644 --- a/src/stats-proxy.c +++ b/src/stats-proxy.c @@ -85,8 +85,8 @@ const struct stat_col stat_cols_px[ST_I_PX_MAX] = { [ST_I_PX_SMAX] = { .name = "smax", .alt_name = "max_sessions", .desc = "Highest value of current sessions encountered since process started", .cap = STATS_PX_CAP_LFBS }, [ST_I_PX_SLIM] = { .name = "slim", .alt_name = "limit_sessions", .desc = "Frontend/listener/server's maxconn, backend's fullconn", .cap = STATS_PX_CAP_LFBS }, [ST_I_PX_STOT] = ME_NEW_PX_SHARED("stot", "sessions_total", FN_COUNTER, FF_U64, cum_sess, STATS_PX_CAP_LFBS, "Total number of sessions since process started"), - [ST_I_PX_BIN] = ME_NEW_PX_SHARED("bin", "bytes_in_total", FN_COUNTER, FF_U64, bytes_in, STATS_PX_CAP_LFBS, "Total number of request bytes since process started"), - [ST_I_PX_BOUT] = ME_NEW_PX_SHARED("bout", "bytes_out_total", FN_COUNTER, FF_U64, bytes_out, STATS_PX_CAP_LFBS, "Total number of response bytes since process started"), + [ST_I_PX_BIN] = ME_NEW_PX_SHARED("bin", "bytes_in_total", FN_COUNTER, FF_U64, req_in, STATS_PX_CAP_LFBS, "Total number of request bytes since process started"), + [ST_I_PX_BOUT] = ME_NEW_PX_SHARED("bout", "bytes_out_total", FN_COUNTER, FF_U64, res_in, STATS_PX_CAP_LFBS, "Total number of response bytes since process started"), [ST_I_PX_DREQ] = ME_NEW_PX_SHARED("dreq", "requests_denied_total", FN_COUNTER, FF_U64, denied_req, STATS_PX_CAP_LFB_, "Total number of denied requests since process started"), [ST_I_PX_DRESP] = ME_NEW_PX_SHARED("dresp", "responses_denied_total", FN_COUNTER, FF_U64, denied_resp, STATS_PX_CAP_LFBS, "Total number of denied responses since process started"), [ST_I_PX_EREQ] = ME_NEW_FE_SHARED("ereq", "request_errors_total", FN_COUNTER, FF_U64, failed_req, STATS_PX_CAP_LF__, "Total number of invalid requests since process started"), diff --git a/src/stream.c b/src/stream.c index a9539fa5b..65457601c 100644 --- a/src/stream.c +++ b/src/stream.c @@ -829,24 +829,16 @@ void stream_process_counters(struct stream *s) bytes = s->scf->bytes_in - s->logs.req_in; s->logs.req_in = s->scf->bytes_in; if (bytes) { - if (sess->fe_tgcounters) { - _HA_ATOMIC_ADD(&sess->fe_tgcounters->bytes_in, bytes); + if (sess->fe_tgcounters) _HA_ATOMIC_ADD(&sess->fe_tgcounters->req_in, bytes); - } - if (s->be_tgcounters) { - _HA_ATOMIC_ADD(&s->be_tgcounters->bytes_in, bytes); + if (s->be_tgcounters) _HA_ATOMIC_ADD(&s->be_tgcounters->req_in, bytes); - } - if (s->sv_tgcounters) { - _HA_ATOMIC_ADD(&s->sv_tgcounters->bytes_in, bytes); + if (s->sv_tgcounters) _HA_ATOMIC_ADD(&s->sv_tgcounters->req_in, bytes); - } - if (sess->li_tgcounters) { - _HA_ATOMIC_ADD(&sess->li_tgcounters->bytes_in, bytes); + if (sess->li_tgcounters) _HA_ATOMIC_ADD(&sess->li_tgcounters->req_in, bytes); - } for (i = 0; i < global.tune.nb_stk_ctr; i++) { if (!stkctr_inc_bytes_in_ctr(&s->stkctr[i], bytes)) @@ -872,24 +864,16 @@ void stream_process_counters(struct stream *s) bytes = s->scb->bytes_in - s->logs.res_in; s->logs.res_in = s->scb->bytes_in; if (bytes) { - if (sess->fe_tgcounters) { - _HA_ATOMIC_ADD(&sess->fe_tgcounters->bytes_out, bytes); + if (sess->fe_tgcounters) _HA_ATOMIC_ADD(&sess->fe_tgcounters->res_in, bytes); - } - if (s->be_tgcounters) { - _HA_ATOMIC_ADD(&s->be_tgcounters->bytes_out, bytes); + if (s->be_tgcounters) _HA_ATOMIC_ADD(&s->be_tgcounters->res_in, bytes); - } - if (s->sv_tgcounters) { - _HA_ATOMIC_ADD(&s->sv_tgcounters->bytes_out, bytes); + if (s->sv_tgcounters) _HA_ATOMIC_ADD(&s->sv_tgcounters->res_in, bytes); - } - if (sess->li_tgcounters) { - _HA_ATOMIC_ADD(&sess->li_tgcounters->bytes_out, bytes); + if (sess->li_tgcounters) _HA_ATOMIC_ADD(&sess->li_tgcounters->res_in, bytes); - } for (i = 0; i < global.tune.nb_stk_ctr; i++) { if (!stkctr_inc_bytes_out_ctr(&s->stkctr[i], bytes))