]> git.ipfire.org Git - thirdparty/haproxy.git/commitdiff
MINOR: counters: Remove bytes_in and bytes_out counter from fe/be/srv/li
authorChristopher Faulet <cfaulet@haproxy.com>
Tue, 4 Nov 2025 18:00:43 +0000 (19:00 +0100)
committerChristopher Faulet <cfaulet@haproxy.com>
Thu, 6 Nov 2025 14:01:29 +0000 (15:01 +0100)
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.

include/haproxy/counters-t.h
src/stats-proxy.c
src/stream.c

index 4966197e99e7b3d182142f74073ee26e67bf0dbb..2cdb4582bc92d846ae463b18807128be40189bee 100644 (file)
@@ -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 */\
index bc1b6750c3d65122418133c4e0284ecec64c85f7..a7094653c666a5082e90433685fc7a3b8db938ac 100644 (file)
@@ -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"),
index a9539fa5b223b43b93b4995b164508fa991da708..65457601c22a23a81f4bc6a1969ad902fa5bf0fa 100644 (file)
@@ -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))