mirror of
https://git.haproxy.org/git/haproxy.git/
synced 2025-08-07 15:47:01 +02:00
[STATS] report HTTP requests (total and rate) in frontends
Now that we support keep-alive, it's important to report a separate counter for requests. Right now it just appears in the CSV output.
This commit is contained in:
parent
b97f199d4b
commit
d9b587f260
@ -89,6 +89,15 @@ static void inline proxy_inc_be_ctr(struct proxy *be)
|
|||||||
be->counters.be_sps_max = be->be_sess_per_sec.curr_ctr;
|
be->counters.be_sps_max = be->be_sess_per_sec.curr_ctr;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* increase the number of cumulated requests on the designated frontend */
|
||||||
|
static void inline proxy_inc_fe_req_ctr(struct proxy *fe)
|
||||||
|
{
|
||||||
|
fe->counters.cum_fe_req++;
|
||||||
|
update_freq_ctr(&fe->fe_req_per_sec, 1);
|
||||||
|
if (fe->fe_req_per_sec.curr_ctr > fe->counters.fe_rps_max)
|
||||||
|
fe->counters.fe_rps_max = fe->fe_req_per_sec.curr_ctr;
|
||||||
|
}
|
||||||
|
|
||||||
#endif /* _PROTO_PROXY_H */
|
#endif /* _PROTO_PROXY_H */
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
@ -25,9 +25,11 @@
|
|||||||
struct pxcounters {
|
struct pxcounters {
|
||||||
unsigned int feconn_max, beconn_max; /* max # of active frontend and backend sessions */
|
unsigned int feconn_max, beconn_max; /* max # of active frontend and backend sessions */
|
||||||
|
|
||||||
|
long long cum_fe_req; /* cumulated number of processed HTTP requests */
|
||||||
long long cum_feconn, cum_beconn; /* cumulated number of processed sessions */
|
long long cum_feconn, cum_beconn; /* cumulated number of processed sessions */
|
||||||
long long cum_lbconn; /* cumulated number of sessions processed by load balancing */
|
long long cum_lbconn; /* cumulated number of sessions processed by load balancing */
|
||||||
|
|
||||||
|
unsigned int fe_rps_max; /* maximum of new sessions per second seen on the frontend */
|
||||||
unsigned int fe_sps_max; /* maximum of new sessions per second seen on the frontend */
|
unsigned int fe_sps_max; /* maximum of new sessions per second seen on the frontend */
|
||||||
unsigned int be_sps_max; /* maximum of new sessions per second seen on the backend */
|
unsigned int be_sps_max; /* maximum of new sessions per second seen on the backend */
|
||||||
unsigned int nbpend_max; /* max number of pending connections with no server assigned yet */
|
unsigned int nbpend_max; /* max number of pending connections with no server assigned yet */
|
||||||
|
@ -225,6 +225,7 @@ struct proxy {
|
|||||||
int nbpend; /* number of pending connections with no server assigned yet */
|
int nbpend; /* number of pending connections with no server assigned yet */
|
||||||
int totpend; /* total number of pending connections on this instance (for stats) */
|
int totpend; /* total number of pending connections on this instance (for stats) */
|
||||||
unsigned int feconn, beconn; /* # of active frontend and backends sessions */
|
unsigned int feconn, beconn; /* # of active frontend and backends sessions */
|
||||||
|
struct freq_ctr fe_req_per_sec; /* HTTP requests per second on the frontend */
|
||||||
struct freq_ctr fe_sess_per_sec; /* sessions per second on the frontend */
|
struct freq_ctr fe_sess_per_sec; /* sessions per second on the frontend */
|
||||||
struct freq_ctr be_sess_per_sec; /* sessions per second on the backend */
|
struct freq_ctr be_sess_per_sec; /* sessions per second on the backend */
|
||||||
unsigned int maxconn; /* max # of active sessions on the frontend */
|
unsigned int maxconn; /* max # of active sessions on the frontend */
|
||||||
|
@ -248,6 +248,7 @@ int print_csv_header(struct chunk *msg)
|
|||||||
"rate,rate_lim,rate_max,"
|
"rate,rate_lim,rate_max,"
|
||||||
"check_status,check_code,check_duration,"
|
"check_status,check_code,check_duration,"
|
||||||
"hrsp_1xx,hrsp_2xx,hrsp_3xx,hrsp_4xx,hrsp_5xx,hrsp_other,hanafail,"
|
"hrsp_1xx,hrsp_2xx,hrsp_3xx,hrsp_4xx,hrsp_5xx,hrsp_other,hanafail,"
|
||||||
|
"req_rate, req_rate_max, req_tot,"
|
||||||
"\n");
|
"\n");
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -358,6 +359,7 @@ int stats_sock_parse_request(struct stream_interface *si, char *line)
|
|||||||
else {
|
else {
|
||||||
px->counters.feconn_max = 0;
|
px->counters.feconn_max = 0;
|
||||||
px->counters.beconn_max = 0;
|
px->counters.beconn_max = 0;
|
||||||
|
px->counters.fe_rps_max = 0;
|
||||||
px->counters.fe_sps_max = 0;
|
px->counters.fe_sps_max = 0;
|
||||||
px->counters.be_sps_max = 0;
|
px->counters.be_sps_max = 0;
|
||||||
px->counters.nbpend_max = 0;
|
px->counters.nbpend_max = 0;
|
||||||
@ -1512,6 +1514,11 @@ int stats_dump_proxy(struct session *s, struct proxy *px, struct uri_auth *uri)
|
|||||||
/* failed health analyses */
|
/* failed health analyses */
|
||||||
chunk_printf(&msg, ",");
|
chunk_printf(&msg, ",");
|
||||||
|
|
||||||
|
/* requests : req_rate, req_rate_max, req_tot, */
|
||||||
|
chunk_printf(&msg, "%u,%u,%lld,",
|
||||||
|
read_freq_ctr(&px->fe_req_per_sec),
|
||||||
|
px->counters.fe_rps_max, px->counters.cum_fe_req);
|
||||||
|
|
||||||
/* finish with EOL */
|
/* finish with EOL */
|
||||||
chunk_printf(&msg, "\n");
|
chunk_printf(&msg, "\n");
|
||||||
}
|
}
|
||||||
@ -1637,6 +1644,8 @@ int stats_dump_proxy(struct session *s, struct proxy *px, struct uri_auth *uri)
|
|||||||
",,,,,,"
|
",,,,,,"
|
||||||
/* failed health analyses */
|
/* failed health analyses */
|
||||||
","
|
","
|
||||||
|
/* requests : req_rate, req_rate_max, req_tot, */
|
||||||
|
",,,"
|
||||||
"\n",
|
"\n",
|
||||||
px->id, l->name,
|
px->id, l->name,
|
||||||
l->nbconn, l->counters->conn_max,
|
l->nbconn, l->counters->conn_max,
|
||||||
@ -2019,6 +2028,9 @@ int stats_dump_proxy(struct session *s, struct proxy *px, struct uri_auth *uri)
|
|||||||
/* failed health analyses */
|
/* failed health analyses */
|
||||||
chunk_printf(&msg, "%lld,", sv->counters.failed_hana);
|
chunk_printf(&msg, "%lld,", sv->counters.failed_hana);
|
||||||
|
|
||||||
|
/* requests : req_rate, req_rate_max, req_tot, */
|
||||||
|
chunk_printf(&msg, ",,,");
|
||||||
|
|
||||||
/* finish with EOL */
|
/* finish with EOL */
|
||||||
chunk_printf(&msg, "\n");
|
chunk_printf(&msg, "\n");
|
||||||
}
|
}
|
||||||
@ -2192,6 +2204,9 @@ int stats_dump_proxy(struct session *s, struct proxy *px, struct uri_auth *uri)
|
|||||||
/* failed health analyses */
|
/* failed health analyses */
|
||||||
chunk_printf(&msg, ",");
|
chunk_printf(&msg, ",");
|
||||||
|
|
||||||
|
/* requests : req_rate, req_rate_max, req_tot, */
|
||||||
|
chunk_printf(&msg, ",,,");
|
||||||
|
|
||||||
/* finish with EOL */
|
/* finish with EOL */
|
||||||
chunk_printf(&msg, "\n");
|
chunk_printf(&msg, "\n");
|
||||||
|
|
||||||
|
@ -2559,6 +2559,8 @@ int http_wait_for_request(struct session *s, struct buffer *req, int an_bit)
|
|||||||
* left uninitialized (for instance in the absence of headers).
|
* left uninitialized (for instance in the absence of headers).
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
proxy_inc_fe_req_ctr(s->fe); /* one more valid request for this FE */
|
||||||
|
|
||||||
if (txn->flags & TX_WAIT_NEXT_RQ) {
|
if (txn->flags & TX_WAIT_NEXT_RQ) {
|
||||||
/* kill the pending keep-alive timeout */
|
/* kill the pending keep-alive timeout */
|
||||||
txn->flags &= ~TX_WAIT_NEXT_RQ;
|
txn->flags &= ~TX_WAIT_NEXT_RQ;
|
||||||
|
Loading…
Reference in New Issue
Block a user