]> git.ipfire.org Git - thirdparty/haproxy.git/commitdiff
MINOR: sample/stats: Add "bytes" in req_{in,out} and res_{in,out} names
authorChristopher Faulet <cfaulet@haproxy.com>
Fri, 7 Nov 2025 13:09:46 +0000 (14:09 +0100)
committerChristopher Faulet <cfaulet@haproxy.com>
Fri, 7 Nov 2025 13:09:48 +0000 (14:09 +0100)
Number of bytes received or sent by a client or a server are now
saved. Sample fetches and stats fields to retrieve these informations are
renamed to add "bytes" in names to avoid any ambiguity with number of
requests and responses.

doc/configuration.txt
src/sample.c
src/stats-proxy.c

index 70a1a81f9953c04945f42980b41214caf09972f8..26c78fde670dd2e9a2e0eb6468e5df60af856908 100644 (file)
@@ -23118,10 +23118,10 @@ fe_client_timeout                                  integer
 fe_defbe                                           string
 fe_id                                              integer
 fe_name                                            string
-req.in                                             integer
-req.out                                            integer
-res.in                                             integer
-res.out                                            integer
+req.bytes_in                                       integer
+req.bytes_out                                      integer
+res.bytes_in                                       integer
+res.bytes_out                                      integer
 res.timer.data                                     integer
 sc0_bytes_in_rate([<table>])                       integer
 sc0_bytes_out_rate([<table>])                      integer
@@ -23426,10 +23426,10 @@ be_tunnel_timeout : integer
   also the "cur_tunnel_timeout".
 
 bytes_in : integer
-  See "req.in".
+  See "req.bytes_in".
 
 bytes_out : integer
-  See "res.in".
+  See "res.bytes_in".
 
 cur_client_timeout : integer
   Returns the currently applied client timeout in millisecond for the stream.
@@ -23751,24 +23751,24 @@ fe_name : string
   backends to check from which frontend it was called, or to stick all users
   coming via a same frontend to the same server.
 
-req.in : integer
+req.bytes_in : integer
   This returns the number of bytes received from the client. The value
   corresponds to what was received by HAProxy, including some headers and some
   internal encoding overhead. Request compression does not affect the value
   reported here.
 
-req.out : integer
+req.bytes_out : integer
   This returns the number of bytes sent to the server. The value corresponds to
   what was sent by HAProxy, including some headers and some internal encoding
   overhead. Request compression affects the value reported here.
 
-res.in : integer
+res.bytes_in : integer
   This returns the number of bytes received from the server. The value
   corresponds to what was received by HAProxy, including some headers and some
   internal encoding overhead. Response compression does not affect the value
   reported here.
 
-res.out : integer
+res.bytes_out : integer
   This returns the number of bytes sent to the client. The value corresponds to
   what was sent by HAProxy, including some headers and some internal encoding
   overhead. Response compression affects the value reported here.
@@ -27847,7 +27847,7 @@ Please refer to the table below for currently defined aliases :
   |                          Others                                           |
   +---+------+------------------------------------------------------+---------+
   |   | %B   | bytes_read           (from server to client)         | numeric |
-  |   |      | %[res_in]                                            |         |
+  |   |      | %[req.bytes_in]                                      |         |
   +---+------+------------------------------------------------------+---------+
   | H | %CC  | captured_request_cookie                              | string  |
   +---+------+------------------------------------------------------+---------+
@@ -27878,7 +27878,7 @@ Please refer to the table below for currently defined aliases :
   |   |      | %[txn.status]                                        |         |
   +---+------+------------------------------------------------------+---------+
   |   | %U   | bytes_uploaded       (from client to server)         | numeric |
-  |   |      | %[req_in]                                            |         |
+  |   |      | %[req.bytes_in]                                      |         |
   +---+------+------------------------------------------------------+---------+
   |   | %ac  | actconn                                              |         |
   |   |      | %[act_conn]                                          | numeric |
index 943adc7a0110799eabd431b8611eb465b3d0bf11..6c658176dfc92f1e81d7b467f03ee69ca29c9f16 100644 (file)
@@ -5444,10 +5444,10 @@ static int smp_fetch_bytes(const struct arg *args, struct sample *smp, const cha
        if (!logs)
                return 0;
 
-       if (kw[2] == 'q') /* req.in or req.out */
-               smp->data.u.sint = (kw[4] == 'i') ? logs->req_in : logs->req_out;
-       if (kw[2] == 's') /* res.in or res.out */
-               smp->data.u.sint = (kw[4] == 'i') ? logs->res_in : logs->res_out;
+       if (kw[2] == 'q') /* req.bytes_in or req.bytes_out */
+               smp->data.u.sint = (kw[10] == 'i') ? logs->req_in : logs->req_out;
+       if (kw[2] == 's') /* res.bytes_in or res.bytes_out */
+               smp->data.u.sint = (kw[10] == 'i') ? logs->res_in : logs->res_out;
        else /* bytes_in or bytes_out */
                smp->data.u.sint = (kw[6] == 'i') ? logs->req_in : logs->res_in;
 
@@ -5497,14 +5497,14 @@ static struct sample_fetch_kw_list smp_logs_kws = {ILH, {
        { "fc.timer.handshake",   smp_fetch_conn_timers,  0,         NULL, SMP_T_SINT, SMP_USE_L4CLI }, /* "Th" */
        { "fc.timer.total",       smp_fetch_conn_timers,  0,         NULL, SMP_T_SINT, SMP_USE_SSFIN }, /* "Tt" */
 
-       { "req.in",               smp_fetch_bytes,        0,         NULL, SMP_T_SINT, SMP_USE_INTRN },
-       { "req.out",              smp_fetch_bytes,        0,         NULL, SMP_T_SINT, SMP_USE_INTRN },
+       { "req.bytes_in",         smp_fetch_bytes,        0,         NULL, SMP_T_SINT, SMP_USE_INTRN },
+       { "req.bytes_out",        smp_fetch_bytes,        0,         NULL, SMP_T_SINT, SMP_USE_INTRN },
        { "req.timer.idle",       smp_fetch_reX_timers,   0,         NULL, SMP_T_SINT, SMP_USE_HRQHV }, /* "Ti" */
        { "req.timer.tq",         smp_fetch_reX_timers,   0,         NULL, SMP_T_SINT, SMP_USE_HRQHV }, /* "Tq" */
        { "req.timer.hdr",        smp_fetch_reX_timers,   0,         NULL, SMP_T_SINT, SMP_USE_HRQHV }, /* "TR" */
        { "req.timer.queue",      smp_fetch_reX_timers,   0,         NULL, SMP_T_SINT, SMP_USE_L4SRV }, /* "Tw" */
-       { "res.in",               smp_fetch_bytes,        0,         NULL, SMP_T_SINT, SMP_USE_INTRN },
-       { "res.out",              smp_fetch_bytes,        0,         NULL, SMP_T_SINT, SMP_USE_INTRN },
+       { "res.bytes_in",         smp_fetch_bytes,        0,         NULL, SMP_T_SINT, SMP_USE_INTRN },
+       { "res.bytes_out",        smp_fetch_bytes,        0,         NULL, SMP_T_SINT, SMP_USE_INTRN },
        { "res.timer.data",       smp_fetch_reX_timers,   0,         NULL, SMP_T_SINT, SMP_USE_RSFIN }, /* "Td" */
        { "res.timer.hdr",        smp_fetch_reX_timers,   0,         NULL, SMP_T_SINT, SMP_USE_HRSHV }, /* "Tr" */
        { /* END */ },
index a94bed221175c14fa43925d99a3f518f726e6833..cb4e229baf4838324335d40db72a897ba80a885e 100644 (file)
@@ -192,10 +192,10 @@ const struct stat_col stat_cols_px[ST_I_PX_MAX] = {
        [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},
-       [ST_I_PX_REQ_IN]        = ME_NEW_PX_SHARED("reqin",        "req_in_total",                  FN_COUNTER, FF_U64, req_in,               STATS_PX_CAP_LFBS, "Total number of request bytes received since process started"),
-       [ST_I_PX_REQ_OUT]       = ME_NEW_PX_SHARED("reqout",       "req_out_total",                 FN_COUNTER, FF_U64, req_out,              STATS_PX_CAP_LFBS, "Total number of request bytes sent since process started"),
-       [ST_I_PX_RES_IN]        = ME_NEW_PX_SHARED("resin",        "res_in_total",                  FN_COUNTER, FF_U64, res_in,               STATS_PX_CAP_LFBS, "Total number of response bytes received since process started"),
-       [ST_I_PX_RES_OUT]       = ME_NEW_PX_SHARED("resout",       "res_out_total",                 FN_COUNTER, FF_U64, res_out,              STATS_PX_CAP_LFBS, "Total number of response bytes sent since process started"),
+       [ST_I_PX_REQ_IN]        = ME_NEW_PX_SHARED("reqbin",        "req_bytes_in_total",            FN_COUNTER, FF_U64, req_in,               STATS_PX_CAP_LFBS, "Total number of request bytes received since process started"),
+       [ST_I_PX_REQ_OUT]       = ME_NEW_PX_SHARED("reqbout",       "req_bytes_out_total",           FN_COUNTER, FF_U64, req_out,              STATS_PX_CAP_LFBS, "Total number of request bytes sent since process started"),
+       [ST_I_PX_RES_IN]        = ME_NEW_PX_SHARED("resbin",        "res_bytes_in_total",            FN_COUNTER, FF_U64, res_in,               STATS_PX_CAP_LFBS, "Total number of response bytes received since process started"),
+       [ST_I_PX_RES_OUT]       = ME_NEW_PX_SHARED("resbout",       "res_bytes_out_total",           FN_COUNTER, FF_U64, res_out,              STATS_PX_CAP_LFBS, "Total number of response bytes sent since process started"),
 
 };