mirror of
https://git.haproxy.org/git/haproxy.git/
synced 2025-11-07 12:01:31 +01:00
MINOR: counters: Add req_in/req_out/res_in/res_out counters for fe/be/srv/li
Thanks to the previous patch, and based on info available on the stream, it is now possible to have counters for frontends, backends, servers and listeners to report number of bytes received and sent on both sides. This patch is related to issue #1617.
This commit is contained in:
parent
ac9201f929
commit
1c62a6f501
@ -45,6 +45,10 @@
|
||||
long long cli_aborts; /* aborted responses during DATA phase caused by the client */\
|
||||
long long internal_errors; /* internal processing errors */\
|
||||
long long failed_rewrites; /* failed rewrites (warning) */\
|
||||
long long req_in; /* number of bytes received from the client */\
|
||||
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 */\
|
||||
|
||||
55
src/stream.c
55
src/stream.c
@ -867,10 +867,65 @@ 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->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;
|
||||
s->logs.req_out = s->scb->bytes_out;
|
||||
if (bytes) {
|
||||
if (sess->fe_tgcounters)
|
||||
_HA_ATOMIC_ADD(&sess->fe_tgcounters->req_out, bytes);
|
||||
if (s->be_tgcounters)
|
||||
_HA_ATOMIC_ADD(&s->be_tgcounters->req_out, bytes);
|
||||
|
||||
if (s->sv_tgcounters)
|
||||
_HA_ATOMIC_ADD(&s->sv_tgcounters->req_out, bytes);
|
||||
|
||||
if (sess->li_tgcounters)
|
||||
_HA_ATOMIC_ADD(&sess->li_tgcounters->req_out, bytes);
|
||||
}
|
||||
|
||||
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->res_in, bytes);
|
||||
if (s->be_tgcounters)
|
||||
_HA_ATOMIC_ADD(&s->be_tgcounters->res_in, bytes);
|
||||
|
||||
if (s->sv_tgcounters)
|
||||
_HA_ATOMIC_ADD(&s->sv_tgcounters->res_in, bytes);
|
||||
|
||||
if (sess->li_tgcounters)
|
||||
_HA_ATOMIC_ADD(&sess->li_tgcounters->res_in, bytes);
|
||||
}
|
||||
|
||||
bytes = s->scf->bytes_out - s->logs.res_out;
|
||||
s->logs.res_out = s->scf->bytes_out;
|
||||
if (bytes) {
|
||||
if (sess->fe_tgcounters)
|
||||
_HA_ATOMIC_ADD(&sess->fe_tgcounters->res_out, bytes);
|
||||
if (s->be_tgcounters)
|
||||
_HA_ATOMIC_ADD(&s->be_tgcounters->res_out, bytes);
|
||||
|
||||
if (s->sv_tgcounters)
|
||||
_HA_ATOMIC_ADD(&s->sv_tgcounters->res_out, bytes);
|
||||
|
||||
if (sess->li_tgcounters)
|
||||
_HA_ATOMIC_ADD(&sess->li_tgcounters->res_out, bytes);
|
||||
}
|
||||
}
|
||||
|
||||
/* Abort processing on the both channels in same time */
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user