mirror of
https://git.haproxy.org/git/haproxy.git/
synced 2025-11-08 12:31:21 +01:00
MINOR: stream: Remove bytes_in and bytes_out counters from stream
per-stream bytes_in and bytes_out counters was removed and replaced by req.in and res.in. Coorresponding samples still exists but replies on new counters. This patch is related to issue #1617.
This commit is contained in:
parent
1c62a6f501
commit
567df50d91
@ -23424,16 +23424,10 @@ be_tunnel_timeout : integer
|
|||||||
also the "cur_tunnel_timeout".
|
also the "cur_tunnel_timeout".
|
||||||
|
|
||||||
bytes_in : integer
|
bytes_in : integer
|
||||||
This returns the number of bytes uploaded from the client to the server. The
|
See "req.in".
|
||||||
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.
|
|
||||||
|
|
||||||
bytes_out : integer
|
bytes_out : integer
|
||||||
This is the number of bytes transmitted from the server to the client. The
|
See "res.in".
|
||||||
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.
|
|
||||||
|
|
||||||
cur_client_timeout : integer
|
cur_client_timeout : integer
|
||||||
Returns the currently applied client timeout in millisecond for the stream.
|
Returns the currently applied client timeout in millisecond for the stream.
|
||||||
@ -27851,7 +27845,7 @@ Please refer to the table below for currently defined aliases :
|
|||||||
| Others |
|
| Others |
|
||||||
+---+------+------------------------------------------------------+---------+
|
+---+------+------------------------------------------------------+---------+
|
||||||
| | %B | bytes_read (from server to client) | numeric |
|
| | %B | bytes_read (from server to client) | numeric |
|
||||||
| | | %[bytes_out] | |
|
| | | %[res_in] | |
|
||||||
+---+------+------------------------------------------------------+---------+
|
+---+------+------------------------------------------------------+---------+
|
||||||
| H | %CC | captured_request_cookie | string |
|
| H | %CC | captured_request_cookie | string |
|
||||||
+---+------+------------------------------------------------------+---------+
|
+---+------+------------------------------------------------------+---------+
|
||||||
@ -27882,7 +27876,7 @@ Please refer to the table below for currently defined aliases :
|
|||||||
| | | %[txn.status] | |
|
| | | %[txn.status] | |
|
||||||
+---+------+------------------------------------------------------+---------+
|
+---+------+------------------------------------------------------+---------+
|
||||||
| | %U | bytes_uploaded (from client to server) | numeric |
|
| | %U | bytes_uploaded (from client to server) | numeric |
|
||||||
| | | %[bytes_in] | |
|
| | | %[req_in] | |
|
||||||
+---+------+------------------------------------------------------+---------+
|
+---+------+------------------------------------------------------+---------+
|
||||||
| | %ac | actconn | |
|
| | %ac | actconn | |
|
||||||
| | | %[act_conn] | numeric |
|
| | | %[act_conn] | numeric |
|
||||||
|
|||||||
@ -229,8 +229,6 @@ struct strm_logs {
|
|||||||
long long req_out; /* number of bytes sent to the server */
|
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_in; /* number of bytes received from the server */
|
||||||
long long res_out; /* number of bytes sent to the client */
|
long long res_out; /* number of bytes sent to the client */
|
||||||
long long bytes_in; /* number of bytes transferred from the client to the server */
|
|
||||||
long long bytes_out; /* number of bytes transferred from the server to the client */
|
|
||||||
};
|
};
|
||||||
|
|
||||||
struct stream {
|
struct stream {
|
||||||
|
|||||||
@ -3486,8 +3486,6 @@ int pcli_wait_for_response(struct stream *s, struct channel *rep, int an_bit)
|
|||||||
stream_process_counters(s);
|
stream_process_counters(s);
|
||||||
|
|
||||||
/* don't count other requests' data */
|
/* don't count other requests' data */
|
||||||
s->logs.bytes_in -= ci_data(&s->req);
|
|
||||||
s->logs.bytes_out -= ci_data(&s->res);
|
|
||||||
s->logs.req_in -= ci_data(&s->req);
|
s->logs.req_in -= ci_data(&s->req);
|
||||||
s->logs.res_in -= ci_data(&s->res);
|
s->logs.res_in -= ci_data(&s->res);
|
||||||
|
|
||||||
@ -3524,8 +3522,6 @@ int pcli_wait_for_response(struct stream *s, struct channel *rep, int an_bit)
|
|||||||
s->logs.prx_queue_pos = 0; /* we get the number of pending conns before us */
|
s->logs.prx_queue_pos = 0; /* we get the number of pending conns before us */
|
||||||
s->logs.srv_queue_pos = 0; /* we will get this number soon */
|
s->logs.srv_queue_pos = 0; /* we will get this number soon */
|
||||||
|
|
||||||
s->logs.bytes_in = s->req.total = ci_data(&s->req);
|
|
||||||
s->logs.bytes_out = s->res.total = ci_data(&s->res);
|
|
||||||
s->logs.req_in = s->scf->bytes_in = ci_data(&s->req);
|
s->logs.req_in = s->scf->bytes_in = ci_data(&s->req);
|
||||||
s->logs.res_in = s->scb->bytes_in = ci_data(&s->res);
|
s->logs.res_in = s->scb->bytes_in = ci_data(&s->res);
|
||||||
|
|
||||||
|
|||||||
@ -1998,13 +1998,13 @@ int http_process_res_common(struct stream *s, struct channel *rep, int an_bit, s
|
|||||||
|
|
||||||
/* if the user wants to log as soon as possible, without counting
|
/* if the user wants to log as soon as possible, without counting
|
||||||
* bytes from the server, then this is the right moment. We have
|
* bytes from the server, then this is the right moment. We have
|
||||||
* to temporarily assign bytes_out to log what we currently have.
|
* to temporarily assign req_in to log what we currently have.
|
||||||
*/
|
*/
|
||||||
if (do_log) {
|
if (do_log) {
|
||||||
s->logs.t_close = s->logs.t_data; /* to get a valid end date */
|
s->logs.t_close = s->logs.t_data; /* to get a valid end date */
|
||||||
s->logs.res_in = s->logs.bytes_out = htx->data;
|
s->logs.res_in = htx->data;
|
||||||
s->do_log(s, log_orig(LOG_ORIG_TXN_RESPONSE, LOG_ORIG_FL_NONE));
|
s->do_log(s, log_orig(LOG_ORIG_TXN_RESPONSE, LOG_ORIG_FL_NONE));
|
||||||
s->logs.res_in = s->logs.bytes_out = 0;
|
s->logs.res_in = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
done:
|
done:
|
||||||
|
|||||||
@ -3933,8 +3933,8 @@ int sess_build_logline_orig(struct session *sess, struct stream *s,
|
|||||||
tmp_strm_log.t_connect = -1;
|
tmp_strm_log.t_connect = -1;
|
||||||
tmp_strm_log.t_data = -1;
|
tmp_strm_log.t_data = -1;
|
||||||
tmp_strm_log.t_close = ns_to_ms(now_ns - sess->accept_ts);
|
tmp_strm_log.t_close = ns_to_ms(now_ns - sess->accept_ts);
|
||||||
tmp_strm_log.bytes_in = 0;
|
tmp_strm_log.req_in = tmp_strm_log.req_out = 0;
|
||||||
tmp_strm_log.bytes_out = 0;
|
tmp_strm_log.res_in = tmp_strm_log.res_out = 0;
|
||||||
tmp_strm_log.prx_queue_pos = 0;
|
tmp_strm_log.prx_queue_pos = 0;
|
||||||
tmp_strm_log.srv_queue_pos = 0;
|
tmp_strm_log.srv_queue_pos = 0;
|
||||||
|
|
||||||
@ -4629,14 +4629,14 @@ int sess_build_logline_orig(struct session *sess, struct stream *s,
|
|||||||
case LOG_FMT_BYTES: // %B
|
case LOG_FMT_BYTES: // %B
|
||||||
if (!(fe->to_log & LW_BYTES))
|
if (!(fe->to_log & LW_BYTES))
|
||||||
LOGMETACHAR('+');
|
LOGMETACHAR('+');
|
||||||
ret = lf_int(tmplog, dst + maxsize - tmplog, logs->bytes_out, ctx, LF_INT_LLTOA);
|
ret = lf_int(tmplog, dst + maxsize - tmplog, logs->req_in, ctx, LF_INT_LLTOA);
|
||||||
if (ret == NULL)
|
if (ret == NULL)
|
||||||
goto out;
|
goto out;
|
||||||
tmplog = ret;
|
tmplog = ret;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case LOG_FMT_BYTES_UP: // %U
|
case LOG_FMT_BYTES_UP: // %U
|
||||||
ret = lf_int(tmplog, dst + maxsize - tmplog, logs->bytes_in, ctx, LF_INT_LLTOA);
|
ret = lf_int(tmplog, dst + maxsize - tmplog, logs->res_out, ctx, LF_INT_LLTOA);
|
||||||
if (ret == NULL)
|
if (ret == NULL)
|
||||||
goto out;
|
goto out;
|
||||||
tmplog = ret;
|
tmplog = ret;
|
||||||
|
|||||||
@ -5449,7 +5449,7 @@ static int smp_fetch_bytes(const struct arg *args, struct sample *smp, const cha
|
|||||||
if (kw[2] == 's') /* res.in or res.out */
|
if (kw[2] == 's') /* res.in or res.out */
|
||||||
smp->data.u.sint = (kw[4] == 'i') ? logs->res_in : logs->res_out;
|
smp->data.u.sint = (kw[4] == 'i') ? logs->res_in : logs->res_out;
|
||||||
else /* bytes_in or bytes_out */
|
else /* bytes_in or bytes_out */
|
||||||
smp->data.u.sint = (kw[6] == 'i') ? logs->bytes_in : logs->bytes_out;
|
smp->data.u.sint = (kw[6] == 'i') ? logs->req_in : logs->res_in;
|
||||||
|
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|||||||
79
src/stream.c
79
src/stream.c
@ -370,7 +370,6 @@ struct stream *stream_new(struct session *sess, struct stconn *sc, struct buffer
|
|||||||
s->logs.t_close = 0;
|
s->logs.t_close = 0;
|
||||||
s->logs.req_in = s->logs.req_out = 0;
|
s->logs.req_in = s->logs.req_out = 0;
|
||||||
s->logs.res_in = s->logs.res_out = 0;
|
s->logs.res_in = s->logs.res_out = 0;
|
||||||
s->logs.bytes_in = s->logs.bytes_out = 0;
|
|
||||||
s->logs.prx_queue_pos = 0; /* we get the number of pending conns before us */
|
s->logs.prx_queue_pos = 0; /* we get the number of pending conns before us */
|
||||||
s->logs.srv_queue_pos = 0; /* we will get this number soon */
|
s->logs.srv_queue_pos = 0; /* we will get this number soon */
|
||||||
s->obj_type = OBJ_TYPE_STREAM;
|
s->obj_type = OBJ_TYPE_STREAM;
|
||||||
@ -827,19 +826,27 @@ void stream_process_counters(struct stream *s)
|
|||||||
unsigned long long bytes;
|
unsigned long long bytes;
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
bytes = s->req.total - s->logs.bytes_in;
|
bytes = s->scf->bytes_in - s->logs.req_in;
|
||||||
s->logs.bytes_in = s->req.total;
|
s->logs.req_in = s->scf->bytes_in;
|
||||||
if (bytes) {
|
if (bytes) {
|
||||||
if (sess->fe_tgcounters)
|
if (sess->fe_tgcounters) {
|
||||||
_HA_ATOMIC_ADD(&sess->fe_tgcounters->bytes_in, bytes);
|
_HA_ATOMIC_ADD(&sess->fe_tgcounters->bytes_in, bytes);
|
||||||
if (s->be_tgcounters)
|
_HA_ATOMIC_ADD(&sess->fe_tgcounters->req_in, bytes);
|
||||||
_HA_ATOMIC_ADD(&s->be_tgcounters->bytes_in, bytes);
|
}
|
||||||
|
if (s->be_tgcounters) {
|
||||||
|
_HA_ATOMIC_ADD(&s->be_tgcounters->bytes_in, bytes);
|
||||||
|
_HA_ATOMIC_ADD(&s->be_tgcounters->req_in, bytes);
|
||||||
|
}
|
||||||
|
|
||||||
if (s->sv_tgcounters)
|
if (s->sv_tgcounters) {
|
||||||
_HA_ATOMIC_ADD(&s->sv_tgcounters->bytes_in, bytes);
|
_HA_ATOMIC_ADD(&s->sv_tgcounters->bytes_in, bytes);
|
||||||
|
_HA_ATOMIC_ADD(&s->sv_tgcounters->req_in, bytes);
|
||||||
|
}
|
||||||
|
|
||||||
if (sess->li_tgcounters)
|
if (sess->li_tgcounters) {
|
||||||
_HA_ATOMIC_ADD(&sess->li_tgcounters->bytes_in, bytes);
|
_HA_ATOMIC_ADD(&sess->li_tgcounters->bytes_in, bytes);
|
||||||
|
_HA_ATOMIC_ADD(&sess->li_tgcounters->req_in, bytes);
|
||||||
|
}
|
||||||
|
|
||||||
for (i = 0; i < global.tune.nb_stk_ctr; i++) {
|
for (i = 0; i < global.tune.nb_stk_ctr; i++) {
|
||||||
if (!stkctr_inc_bytes_in_ctr(&s->stkctr[i], bytes))
|
if (!stkctr_inc_bytes_in_ctr(&s->stkctr[i], bytes))
|
||||||
@ -847,41 +854,6 @@ void stream_process_counters(struct stream *s)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
bytes = s->res.total - s->logs.bytes_out;
|
|
||||||
s->logs.bytes_out = s->res.total;
|
|
||||||
if (bytes) {
|
|
||||||
if (sess->fe_tgcounters)
|
|
||||||
_HA_ATOMIC_ADD(&sess->fe_tgcounters->bytes_out, bytes);
|
|
||||||
if (s->be_tgcounters)
|
|
||||||
_HA_ATOMIC_ADD(&s->be_tgcounters->bytes_out, bytes);
|
|
||||||
|
|
||||||
if (s->sv_tgcounters)
|
|
||||||
_HA_ATOMIC_ADD(&s->sv_tgcounters->bytes_out, bytes);
|
|
||||||
|
|
||||||
if (sess->li_tgcounters)
|
|
||||||
_HA_ATOMIC_ADD(&sess->li_tgcounters->bytes_out, bytes);
|
|
||||||
|
|
||||||
for (i = 0; i < global.tune.nb_stk_ctr; i++) {
|
|
||||||
if (!stkctr_inc_bytes_out_ctr(&s->stkctr[i], bytes))
|
|
||||||
stkctr_inc_bytes_out_ctr(&sess->stkctr[i], bytes);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
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->req_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->req_in, bytes);
|
|
||||||
|
|
||||||
if (sess->li_tgcounters)
|
|
||||||
_HA_ATOMIC_ADD(&sess->li_tgcounters->req_in, bytes);
|
|
||||||
}
|
|
||||||
|
|
||||||
bytes = s->scb->bytes_out - s->logs.req_out;
|
bytes = s->scb->bytes_out - s->logs.req_out;
|
||||||
s->logs.req_out = s->scb->bytes_out;
|
s->logs.req_out = s->scb->bytes_out;
|
||||||
if (bytes) {
|
if (bytes) {
|
||||||
@ -900,16 +872,29 @@ void stream_process_counters(struct stream *s)
|
|||||||
bytes = s->scb->bytes_in - s->logs.res_in;
|
bytes = s->scb->bytes_in - s->logs.res_in;
|
||||||
s->logs.res_in = s->scb->bytes_in;
|
s->logs.res_in = s->scb->bytes_in;
|
||||||
if (bytes) {
|
if (bytes) {
|
||||||
if (sess->fe_tgcounters)
|
if (sess->fe_tgcounters) {
|
||||||
|
_HA_ATOMIC_ADD(&sess->fe_tgcounters->bytes_out, bytes);
|
||||||
_HA_ATOMIC_ADD(&sess->fe_tgcounters->res_in, bytes);
|
_HA_ATOMIC_ADD(&sess->fe_tgcounters->res_in, bytes);
|
||||||
if (s->be_tgcounters)
|
}
|
||||||
|
if (s->be_tgcounters) {
|
||||||
|
_HA_ATOMIC_ADD(&s->be_tgcounters->bytes_out, bytes);
|
||||||
_HA_ATOMIC_ADD(&s->be_tgcounters->res_in, bytes);
|
_HA_ATOMIC_ADD(&s->be_tgcounters->res_in, bytes);
|
||||||
|
}
|
||||||
|
|
||||||
if (s->sv_tgcounters)
|
if (s->sv_tgcounters) {
|
||||||
|
_HA_ATOMIC_ADD(&s->sv_tgcounters->bytes_out, bytes);
|
||||||
_HA_ATOMIC_ADD(&s->sv_tgcounters->res_in, bytes);
|
_HA_ATOMIC_ADD(&s->sv_tgcounters->res_in, bytes);
|
||||||
|
}
|
||||||
|
|
||||||
if (sess->li_tgcounters)
|
if (sess->li_tgcounters) {
|
||||||
|
_HA_ATOMIC_ADD(&sess->li_tgcounters->bytes_out, bytes);
|
||||||
_HA_ATOMIC_ADD(&sess->li_tgcounters->res_in, bytes);
|
_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))
|
||||||
|
stkctr_inc_bytes_out_ctr(&sess->stkctr[i], bytes);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
bytes = s->scf->bytes_out - s->logs.res_out;
|
bytes = s->scf->bytes_out - s->logs.res_out;
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user