MINOR: sample: implement bc_{be,srv}_queue samples

%[bc_be_queue] and %[bc_srv_queue] are equivalent to %bq and %sq tags in
log-format.
This commit is contained in:
Aurelien DARRAGON 2024-02-07 10:55:22 +01:00
parent 16014bc5b3
commit 0c437b2dfc
2 changed files with 39 additions and 0 deletions

View File

@ -21025,6 +21025,7 @@ Summary of sample fetch methods in this section and their respective types:
-------------------------------------------------+------------- -------------------------------------------------+-------------
accept_date([<unit>]) integer accept_date([<unit>]) integer
bc.timer.connect integer bc.timer.connect integer
bc_be_queue integer
bc_dst ip bc_dst ip
bc_dst_port integer bc_dst_port integer
bc_err integer bc_err integer
@ -21033,6 +21034,7 @@ bc_glitches integer
bc_http_major integer bc_http_major integer
bc_src ip bc_src ip
bc_src_port integer bc_src_port integer
bc_srv_queue integer
be_id integer be_id integer
be_name string be_name string
bc_rtt(<unit>) integer bc_rtt(<unit>) integer
@ -21251,6 +21253,10 @@ bc.timer.connect : integer
equivalent of %Tc in the log-format. This is reported in milliseconds (ms). equivalent of %Tc in the log-format. This is reported in milliseconds (ms).
For more information see Section 8.4 "Timing events" For more information see Section 8.4 "Timing events"
bc_be_queue : integer
Number of streams de-queued while waiting for a connection slot on the
target backend. This is the equivalent of %bq in the log-format.
bc_dst : ip bc_dst : ip
This is the destination ip address of the connection on the server side, This is the destination ip address of the connection on the server side,
which is the server address HAProxy connected to. It is of type IP and works which is the server address HAProxy connected to. It is of type IP and works
@ -21301,6 +21307,10 @@ bc_src_port : integer
Returns an integer value corresponding to the TCP source port of the Returns an integer value corresponding to the TCP source port of the
connection on the server side, which is the port HAProxy connected from. connection on the server side, which is the port HAProxy connected from.
bc_srv_queue : integer
Number of streams de-queued while waiting for a connection slot on the
target server. This is the equivalent of %sq in the log-format.
be_id : integer be_id : integer
Returns an integer containing the current backend's id. It can be used in Returns an integer containing the current backend's id. It can be used in
frontends with responses to check which backend processed the request. If frontends with responses to check which backend processed the request. If
@ -25400,6 +25410,7 @@ Please refer to the table below for currently defined variables :
| | | %[bc_src_port] | numeric | | | | %[bc_src_port] | numeric |
+---+------+------------------------------------------------------+---------+ +---+------+------------------------------------------------------+---------+
| | %bq | backend_queue | numeric | | | %bq | backend_queue | numeric |
| | | %[bc_be_queue] | |
+---+------+------------------------------------------------------+---------+ +---+------+------------------------------------------------------+---------+
| | %ci | client_ip (accepted address) | | | | %ci | client_ip (accepted address) | |
| | | %[src] | IP | | | | %[src] | IP |
@ -25456,6 +25467,7 @@ Please refer to the table below for currently defined variables :
| | | %[bc_dst_port] | numeric | | | | %[bc_dst_port] | numeric |
+---+------+------------------------------------------------------+---------+ +---+------+------------------------------------------------------+---------+
| | %sq | srv_queue | numeric | | | %sq | srv_queue | numeric |
| | | %[bc_srv_queue] | |
+---+------+------------------------------------------------------+---------+ +---+------+------------------------------------------------------+---------+
| S | %sslc| ssl_ciphers (ex: AES-SHA) | | | S | %sslc| ssl_ciphers (ex: AES-SHA) | |
| | | %[ssl_fc_cipher] | string | | | | %[ssl_fc_cipher] | string |

View File

@ -4915,6 +4915,30 @@ static int smp_fetch_txn_timers(const struct arg *args, struct sample *smp, cons
return 0; return 0;
} }
/* Server conn queueing infos - bc_{be,srv}_queue */
static int smp_fetch_conn_queues(const struct arg *args, struct sample *smp, const char *kw, void *private)
{
struct strm_logs *logs;
if (!smp->strm)
return 0;
smp->data.type = SMP_T_SINT;
smp->flags = 0;
logs = &smp->strm->logs;
if (kw[3] == 'b') {
/* bc_be_queue */
smp->data.u.sint = logs->prx_queue_pos;
}
else {
/* bc_srv_queue */
smp->data.u.sint = logs->srv_queue_pos;
}
return 1;
}
/* Timing events {f,bc}.timer. */ /* Timing events {f,bc}.timer. */
static int smp_fetch_conn_timers(const struct arg *args, struct sample *smp, const char *kw, void *private) static int smp_fetch_conn_timers(const struct arg *args, struct sample *smp, const char *kw, void *private)
{ {
@ -5029,6 +5053,9 @@ static struct sample_fetch_kw_list smp_logs_kws = {ILH, {
{ "txn.timer.user", smp_fetch_txn_timers, 0, NULL, SMP_T_SINT, SMP_USE_TXFIN }, /* "Tu" */ { "txn.timer.user", smp_fetch_txn_timers, 0, NULL, SMP_T_SINT, SMP_USE_TXFIN }, /* "Tu" */
{ "bc.timer.connect", smp_fetch_conn_timers, 0, NULL, SMP_T_SINT, SMP_USE_L4SRV }, /* "Tc" */ { "bc.timer.connect", smp_fetch_conn_timers, 0, NULL, SMP_T_SINT, SMP_USE_L4SRV }, /* "Tc" */
{ "bc_be_queue", smp_fetch_conn_queues, 0, NULL, SMP_T_SINT, SMP_USE_L4SRV }, /* "bq" */
{ "bc_srv_queue", smp_fetch_conn_queues, 0, NULL, SMP_T_SINT, SMP_USE_L4SRV }, /* "sq" */
{ "fc.timer.handshake", smp_fetch_conn_timers, 0, NULL, SMP_T_SINT, SMP_USE_L4CLI }, /* "Th" */ { "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" */ { "fc.timer.total", smp_fetch_conn_timers, 0, NULL, SMP_T_SINT, SMP_USE_SSFIN }, /* "Tt" */