mirror of
https://git.haproxy.org/git/haproxy.git/
synced 2025-09-20 21:31:28 +02:00
MINOR: stream: Expose the stream's uniq_id via a new sample fetch
"txn.id32" may now be used to get the stream's uniq_id. It is equivalent to %rt in logs.
This commit is contained in:
parent
b1eb3bc9a2
commit
0b8e7d666e
@ -20103,6 +20103,12 @@ thread : integer
|
||||
the function, between 0 and (global.nbthread-1). This is useful for logging
|
||||
and debugging purposes.
|
||||
|
||||
txn.id32 : integer
|
||||
Returns the internal transaction ID. It is a 32bits integer. So, in absolute,
|
||||
its value is not unique, transaction IDs may wrap. The wrapping period
|
||||
depends on the request rate. In practice, it should not be an issue. For a
|
||||
true unique ID, see "unique-id-format" directive.
|
||||
|
||||
txn.conn_retries : integer
|
||||
Returns the the number of connection retries experienced by this session when
|
||||
trying to connect to the server. This value is subject to change while the
|
||||
@ -24049,6 +24055,7 @@ Please refer to the table below for currently defined variables :
|
||||
| | | %[txn.conn_retries] | |
|
||||
+---+------+------------------------------------------------------+---------+
|
||||
| | %rt | request_counter (HTTP req or TCP session) | numeric |
|
||||
| | | %[txn.id32] | |
|
||||
+---+------+------------------------------------------------------+---------+
|
||||
| | %s | server_name | string |
|
||||
+---+------+------------------------------------------------------+---------+
|
||||
|
11
src/stream.c
11
src/stream.c
@ -4002,6 +4002,16 @@ static int smp_fetch_conn_retries(const struct arg *args, struct sample *smp, co
|
||||
return 1;
|
||||
}
|
||||
|
||||
static int smp_fetch_id32(const struct arg *args, struct sample *smp, const char *km, void *private)
|
||||
{
|
||||
smp->flags = SMP_F_VOL_TXN;
|
||||
smp->data.type = SMP_T_SINT;
|
||||
if (!smp->strm)
|
||||
return 0;
|
||||
smp->data.u.sint = smp->strm->uniq_id;
|
||||
return 1;
|
||||
}
|
||||
|
||||
/* Note: must not be declared <const> as its list will be overwritten.
|
||||
* Please take care of keeping this list alphabetically sorted.
|
||||
*/
|
||||
@ -4012,6 +4022,7 @@ static struct sample_fetch_kw_list smp_kws = {ILH, {
|
||||
{ "last_rule_file", smp_fetch_last_rule_file, 0, NULL, SMP_T_STR, SMP_USE_INTRN, },
|
||||
{ "last_rule_line", smp_fetch_last_rule_line, 0, NULL, SMP_T_SINT, SMP_USE_INTRN, },
|
||||
{ "txn.conn_retries", smp_fetch_conn_retries, 0, NULL, SMP_T_SINT, SMP_USE_L4SRV, },
|
||||
{ "txn.id32", smp_fetch_id32, 0, NULL, SMP_T_SINT, SMP_USE_INTRN, },
|
||||
{ "txn.sess_term_state",smp_fetch_sess_term_state, 0, NULL, SMP_T_STR, SMP_USE_INTRN, },
|
||||
{ NULL, NULL, 0, 0, 0 },
|
||||
}};
|
||||
|
Loading…
x
Reference in New Issue
Block a user