[MEDIUM] stats: split frontend and backend stats

It's very annoying that frontend and backend stats are merged because we
don't know what we're observing. For instance, if a "listen" instance
makes use of a distinct backend, it's impossible to know what the bytes_out
means.

Some points take care of not updating counters twice if the backend points
to the frontend, indicating a "listen" instance. The thing becomes more
complex when we try to add support for server side keep-alive, because we
have to maintain a pointer to the backend used for last request, and to
update its stats. But we can't perform such comparisons anymore because
the counters will not match anymore.

So in order to get rid of this situation, let's have both frontend AND
backend stats in the "struct proxy". We simply update the relevant ones
during activity. Some of them are only accounted for in the backend,
while others are just for frontend. Maybe we can improve a bit on that
later, but the essential part is that those counters now reflect what
they really mean.
This commit is contained in:
Willy Tarreau 2011-03-10 23:25:56 +01:00
parent 6f5ccb1589
commit 7d0aaf39d1
12 changed files with 215 additions and 186 deletions

View File

@ -71,42 +71,42 @@ static inline void proxy_reset_timeouts(struct proxy *proxy)
/* increase the number of cumulated connections received on the designated frontend */ /* increase the number of cumulated connections received on the designated frontend */
static void inline proxy_inc_fe_conn_ctr(struct listener *l, struct proxy *fe) static void inline proxy_inc_fe_conn_ctr(struct listener *l, struct proxy *fe)
{ {
fe->counters.cum_feconn++; fe->fe_counters.cum_conn++;
if (l->counters) if (l->counters)
l->counters->cum_conn++; l->counters->cum_conn++;
update_freq_ctr(&fe->fe_conn_per_sec, 1); update_freq_ctr(&fe->fe_conn_per_sec, 1);
if (fe->fe_conn_per_sec.curr_ctr > fe->counters.fe_cps_max) if (fe->fe_conn_per_sec.curr_ctr > fe->fe_counters.cps_max)
fe->counters.fe_cps_max = fe->fe_conn_per_sec.curr_ctr; fe->fe_counters.cps_max = fe->fe_conn_per_sec.curr_ctr;
} }
/* increase the number of cumulated connections accepted by the designated frontend */ /* increase the number of cumulated connections accepted by the designated frontend */
static void inline proxy_inc_fe_sess_ctr(struct listener *l, struct proxy *fe) static void inline proxy_inc_fe_sess_ctr(struct listener *l, struct proxy *fe)
{ {
fe->counters.cum_fesess++; fe->fe_counters.cum_sess++;
if (l->counters) if (l->counters)
l->counters->cum_sess++; l->counters->cum_sess++;
update_freq_ctr(&fe->fe_sess_per_sec, 1); update_freq_ctr(&fe->fe_sess_per_sec, 1);
if (fe->fe_sess_per_sec.curr_ctr > fe->counters.fe_sps_max) if (fe->fe_sess_per_sec.curr_ctr > fe->fe_counters.sps_max)
fe->counters.fe_sps_max = fe->fe_sess_per_sec.curr_ctr; fe->fe_counters.sps_max = fe->fe_sess_per_sec.curr_ctr;
} }
/* increase the number of cumulated connections on the designated backend */ /* increase the number of cumulated connections on the designated backend */
static void inline proxy_inc_be_ctr(struct proxy *be) static void inline proxy_inc_be_ctr(struct proxy *be)
{ {
be->counters.cum_beconn++; be->be_counters.cum_conn++;
update_freq_ctr(&be->be_sess_per_sec, 1); update_freq_ctr(&be->be_sess_per_sec, 1);
if (be->be_sess_per_sec.curr_ctr > be->counters.be_sps_max) if (be->be_sess_per_sec.curr_ctr > be->be_counters.sps_max)
be->counters.be_sps_max = be->be_sess_per_sec.curr_ctr; be->be_counters.sps_max = be->be_sess_per_sec.curr_ctr;
} }
/* increase the number of cumulated requests on the designated frontend */ /* increase the number of cumulated requests on the designated frontend */
static void inline proxy_inc_fe_req_ctr(struct proxy *fe) static void inline proxy_inc_fe_req_ctr(struct proxy *fe)
{ {
fe->counters.cum_fe_req++; fe->fe_counters.p.http.cum_req++;
update_freq_ctr(&fe->fe_req_per_sec, 1); update_freq_ctr(&fe->fe_req_per_sec, 1);
if (fe->fe_req_per_sec.curr_ctr > fe->counters.fe_rps_max) if (fe->fe_req_per_sec.curr_ctr > fe->fe_counters.p.http.rps_max)
fe->counters.fe_rps_max = fe->fe_req_per_sec.curr_ctr; fe->fe_counters.p.http.rps_max = fe->fe_req_per_sec.curr_ctr;
} }
#endif /* _PROTO_PROXY_H */ #endif /* _PROTO_PROXY_H */

View File

@ -1,56 +1,61 @@
/* /*
include/types/counters.h * include/types/counters.h
This file contains structure declarations for statistics counters. * This file contains structure declarations for statistics counters.
*
Copyright 2008-2009 Krzysztof Piotr Oledzki <ole@ans.pl> * Copyright 2008-2009 Krzysztof Piotr Oledzki <ole@ans.pl>
* Copyright 2011 Willy Tarreau <w@1wt.eu>
This library is free software; you can redistribute it and/or *
modify it under the terms of the GNU Lesser General Public * This library is free software; you can redistribute it and/or
License as published by the Free Software Foundation, version 2.1 * modify it under the terms of the GNU Lesser General Public
exclusively. * License as published by the Free Software Foundation, version 2.1
* exclusively.
This library is distributed in the hope that it will be useful, *
but WITHOUT ANY WARRANTY; without even the implied warranty of * This library is distributed in the hope that it will be useful,
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * but WITHOUT ANY WARRANTY; without even the implied warranty of
Lesser General Public License for more details. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public *
License along with this library; if not, write to the Free Software * You should have received a copy of the GNU Lesser General Public
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/ */
#ifndef _TYPES_COUNTERS_H #ifndef _TYPES_COUNTERS_H
#define _TYPES_COUNTERS_H #define _TYPES_COUNTERS_H
/* maybe later we might thing about having a different struct for FE and BE */
struct pxcounters { struct pxcounters {
unsigned int feconn_max, beconn_max; /* max # of active frontend and backend sessions */ unsigned int conn_max; /* max # of active sessions */
long long cum_conn; /* cumulated number of received connections */
long long cum_sess; /* cumulated number of accepted connections */
long long cum_lbconn; /* cumulated number of sessions processed by load balancing (BE only) */
long long cum_fe_req; /* cumulated number of processed HTTP requests */ unsigned int cps_max; /* maximum of new connections received per second */
long long cum_feconn, cum_fesess; /* cumulated number of received/accepted connections */ unsigned int sps_max; /* maximum of new connections accepted per second (sessions) */
long long cum_beconn, cum_lbconn; /* cumulated number of sessions processed by load balancing */ unsigned int nbpend_max; /* max number of pending connections with no server assigned yet (BE only) */
unsigned int fe_rps_max; /* maximum of new sessions per second seen on the frontend */
unsigned int fe_cps_max; /* maximum of new connections per second received on the frontend */
unsigned int fe_sps_max; /* maximum of new sessions per second accepted on the frontend */
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 */
long long bytes_in; /* number of bytes transferred from the client to the server */ 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 */ long long bytes_out; /* number of bytes transferred from the server to the client */
long long denied_req, denied_resp; /* blocked requests/responses because of security concerns */ long long denied_req; /* blocked requests/responses because of security concerns */
long long denied_resp; /* blocked requests/responses because of security concerns */
long long failed_req; /* failed requests (eg: invalid or timeout) */ long long failed_req; /* failed requests (eg: invalid or timeout) */
long long denied_conn; /* denied connection requests (tcp-req rules) */ long long denied_conn; /* denied connection requests (tcp-req rules) */
long long failed_conns; /* failed connect() attempts (BE only) */
long long failed_resp; /* failed responses (BE only) */
long long cli_aborts; /* aborted responses during DATA phase caused by the client */
long long srv_aborts; /* aborted responses during DATA phase caused by the server */
long long retries; /* retried and redispatched connections (BE only) */
long long redispatches; /* retried and redispatched connections (BE only) */
union { union {
struct { struct {
long long cum_req; /* cumulated number of processed HTTP requests */
unsigned int rps_max; /* maximum of new HTTP requests second observed */
long long rsp[6]; /* http response codes */ long long rsp[6]; /* http response codes */
} http; } http;
} fe, be; /* FE and BE stats */ } p; /* protocol-specific stats */
long long failed_conns, failed_resp; /* failed connect() and responses */
long long cli_aborts, srv_aborts; /* aborted responses during DATA phase due to client or server */
long long retries, redispatches; /* retried and redispatched connections */
}; };
struct licounters { struct licounters {

View File

@ -297,7 +297,8 @@ struct proxy {
*rsp_cap_pool; *rsp_cap_pool;
struct pool_head *hdr_idx_pool; /* pools of pre-allocated int* used for headers indexing */ struct pool_head *hdr_idx_pool; /* pools of pre-allocated int* used for headers indexing */
struct list req_add, rsp_add; /* headers to be added */ struct list req_add, rsp_add; /* headers to be added */
struct pxcounters counters; /* statistics counters */ struct pxcounters be_counters; /* backend statistics counters */
struct pxcounters fe_counters; /* frontend statistics counters */
struct stktable table; /* table for storing sticking sessions */ struct stktable table; /* table for storing sticking sessions */

View File

@ -613,7 +613,7 @@ int assign_server(struct session *s)
goto out; goto out;
} }
else if (srv != prev_srv) { else if (srv != prev_srv) {
s->be->counters.cum_lbconn++; s->be->be_counters.cum_lbconn++;
srv->counters.cum_lbconn++; srv->counters.cum_lbconn++;
} }
set_target_server(&s->target, srv); set_target_server(&s->target, srv);
@ -800,10 +800,10 @@ int assign_server_and_queue(struct session *s)
} }
s->flags |= SN_REDISP; s->flags |= SN_REDISP;
prev_srv->counters.redispatches++; prev_srv->counters.redispatches++;
s->be->counters.redispatches++; s->be->be_counters.redispatches++;
} else { } else {
prev_srv->counters.retries++; prev_srv->counters.retries++;
s->be->counters.retries++; s->be->be_counters.retries++;
} }
} }
} }
@ -1036,7 +1036,7 @@ int srv_redispatch_connect(struct session *t)
} }
srv->counters.failed_conns++; srv->counters.failed_conns++;
t->be->counters.failed_conns++; t->be->be_counters.failed_conns++;
return 1; return 1;
case SRV_STATUS_NOSRV: case SRV_STATUS_NOSRV:
@ -1046,7 +1046,7 @@ int srv_redispatch_connect(struct session *t)
t->req->cons->err_loc = NULL; t->req->cons->err_loc = NULL;
} }
t->be->counters.failed_conns++; t->be->be_counters.failed_conns++;
return 1; return 1;
case SRV_STATUS_QUEUED: case SRV_STATUS_QUEUED:
@ -1066,7 +1066,7 @@ int srv_redispatch_connect(struct session *t)
srv_inc_sess_ctr(srv); srv_inc_sess_ctr(srv);
if (srv) if (srv)
srv->counters.failed_conns++; srv->counters.failed_conns++;
t->be->counters.failed_conns++; t->be->be_counters.failed_conns++;
/* release other sessions waiting for this server */ /* release other sessions waiting for this server */
if (may_dequeue_tasks(srv, t->be)) if (may_dequeue_tasks(srv, t->be))

View File

@ -493,16 +493,22 @@ int stats_sock_parse_request(struct stream_interface *si, char *line)
} }
for (px = proxy; px; px = px->next) { for (px = proxy; px; px = px->next) {
if (clrall) if (clrall) {
memset(&px->counters, 0, sizeof(px->counters)); memset(&px->be_counters, 0, sizeof(px->be_counters));
memset(&px->fe_counters, 0, sizeof(px->fe_counters));
}
else { else {
px->counters.feconn_max = 0; px->be_counters.conn_max = 0;
px->counters.beconn_max = 0; px->be_counters.p.http.rps_max = 0;
px->counters.fe_rps_max = 0; px->be_counters.sps_max = 0;
px->counters.fe_sps_max = 0; px->be_counters.cps_max = 0;
px->counters.fe_cps_max = 0; px->be_counters.nbpend_max = 0;
px->counters.be_sps_max = 0;
px->counters.nbpend_max = 0; px->fe_counters.conn_max = 0;
px->fe_counters.p.http.rps_max = 0;
px->fe_counters.sps_max = 0;
px->fe_counters.cps_max = 0;
px->fe_counters.nbpend_max = 0;
} }
for (sv = px->srv; sv; sv = sv->next) for (sv = px->srv; sv; sv = sv->next)
@ -1761,8 +1767,8 @@ int stats_dump_proxy(struct stream_interface *si, struct proxy *px, struct uri_a
"", "",
read_freq_ctr(&px->fe_req_per_sec), read_freq_ctr(&px->fe_req_per_sec),
U2H0(read_freq_ctr(&px->fe_sess_per_sec)), U2H0(read_freq_ctr(&px->fe_sess_per_sec)),
px->counters.fe_rps_max, px->fe_counters.p.http.rps_max,
U2H1(px->counters.fe_sps_max), U2H1(px->fe_counters.sps_max),
LIM2A2(px->fe_sps_lim, "-")); LIM2A2(px->fe_sps_lim, "-"));
} else { } else {
chunk_printf(&msg, chunk_printf(&msg,
@ -1770,7 +1776,7 @@ int stats_dump_proxy(struct stream_interface *si, struct proxy *px, struct uri_a
"<td>%s</td><td>%s</td><td>%s</td>" "<td>%s</td><td>%s</td><td>%s</td>"
"", "",
U2H0(read_freq_ctr(&px->fe_sess_per_sec)), U2H0(read_freq_ctr(&px->fe_sess_per_sec)),
U2H1(px->counters.fe_sps_max), LIM2A2(px->fe_sps_lim, "-")); U2H1(px->fe_counters.sps_max), LIM2A2(px->fe_sps_lim, "-"));
} }
chunk_printf(&msg, chunk_printf(&msg,
@ -1778,18 +1784,18 @@ int stats_dump_proxy(struct stream_interface *si, struct proxy *px, struct uri_a
"<td>%s</td><td>%s</td><td>%s</td>" "<td>%s</td><td>%s</td><td>%s</td>"
"<td" "<td"
"", "",
U2H3(px->feconn), U2H4(px->counters.feconn_max), U2H5(px->maxconn)); U2H3(px->feconn), U2H4(px->fe_counters.conn_max), U2H5(px->maxconn));
/* http response (via td title): 1xx, 2xx, 3xx, 4xx, 5xx, other */ /* http response (via td title): 1xx, 2xx, 3xx, 4xx, 5xx, other */
if (px->mode == PR_MODE_HTTP) { if (px->mode == PR_MODE_HTTP) {
int i; int i;
chunk_printf(&msg, " title=\"%lld requests:", px->counters.cum_fe_req); chunk_printf(&msg, " title=\"%lld requests:", px->fe_counters.p.http.cum_req);
for (i = 1; i < 6; i++) for (i = 1; i < 6; i++)
chunk_printf(&msg, " %dxx=%lld,", i, px->counters.fe.http.rsp[i]); chunk_printf(&msg, " %dxx=%lld,", i, px->fe_counters.p.http.rsp[i]);
chunk_printf(&msg, " other=%lld\"", px->counters.fe.http.rsp[0]); chunk_printf(&msg, " other=%lld\"", px->fe_counters.p.http.rsp[0]);
} }
chunk_printf(&msg, chunk_printf(&msg,
@ -1799,9 +1805,9 @@ int stats_dump_proxy(struct stream_interface *si, struct proxy *px, struct uri_a
"<td>%s</td><td>%s</td>" "<td>%s</td><td>%s</td>"
"", "",
(px->mode == PR_MODE_HTTP)?"<u>":"", (px->mode == PR_MODE_HTTP)?"<u>":"",
U2H6(px->counters.cum_fesess), U2H6(px->fe_counters.cum_sess),
(px->mode == PR_MODE_HTTP)?"</u>":"", (px->mode == PR_MODE_HTTP)?"</u>":"",
U2H7(px->counters.bytes_in), U2H8(px->counters.bytes_out)); U2H7(px->fe_counters.bytes_in), U2H8(px->fe_counters.bytes_out));
chunk_printf(&msg, chunk_printf(&msg,
/* denied: req, resp */ /* denied: req, resp */
@ -1815,8 +1821,8 @@ int stats_dump_proxy(struct stream_interface *si, struct proxy *px, struct uri_a
/* rest of server: nothing */ /* rest of server: nothing */
"<td class=ac colspan=8></td></tr>" "<td class=ac colspan=8></td></tr>"
"", "",
U2H0(px->counters.denied_req), U2H1(px->counters.denied_resp), U2H0(px->fe_counters.denied_req), U2H1(px->fe_counters.denied_resp),
U2H2(px->counters.failed_req), U2H2(px->fe_counters.failed_req),
px->state == PR_STRUN ? "OPEN" : px->state == PR_STRUN ? "OPEN" :
px->state == PR_STIDLE ? "FULL" : "STOP"); px->state == PR_STIDLE ? "FULL" : "STOP");
} else { } else {
@ -1844,24 +1850,24 @@ int stats_dump_proxy(struct stream_interface *si, struct proxy *px, struct uri_a
/* check_status, check_code, check_duration */ /* check_status, check_code, check_duration */
",,,", ",,,",
px->id, px->id,
px->feconn, px->counters.feconn_max, px->maxconn, px->counters.cum_fesess, px->feconn, px->fe_counters.conn_max, px->maxconn, px->fe_counters.cum_sess,
px->counters.bytes_in, px->counters.bytes_out, px->fe_counters.bytes_in, px->fe_counters.bytes_out,
px->counters.denied_req, px->counters.denied_resp, px->fe_counters.denied_req, px->fe_counters.denied_resp,
px->counters.failed_req, px->fe_counters.failed_req,
px->state == PR_STRUN ? "OPEN" : px->state == PR_STRUN ? "OPEN" :
px->state == PR_STIDLE ? "FULL" : "STOP", px->state == PR_STIDLE ? "FULL" : "STOP",
relative_pid, px->uuid, STATS_TYPE_FE, relative_pid, px->uuid, STATS_TYPE_FE,
read_freq_ctr(&px->fe_sess_per_sec), read_freq_ctr(&px->fe_sess_per_sec),
px->fe_sps_lim, px->counters.fe_sps_max); px->fe_sps_lim, px->fe_counters.sps_max);
/* http response: 1xx, 2xx, 3xx, 4xx, 5xx, other */ /* http response: 1xx, 2xx, 3xx, 4xx, 5xx, other */
if (px->mode == PR_MODE_HTTP) { if (px->mode == PR_MODE_HTTP) {
int i; int i;
for (i=1; i<6; i++) for (i=1; i<6; i++)
chunk_printf(&msg, "%lld,", px->counters.fe.http.rsp[i]); chunk_printf(&msg, "%lld,", px->fe_counters.p.http.rsp[i]);
chunk_printf(&msg, "%lld,", px->counters.fe.http.rsp[0]); chunk_printf(&msg, "%lld,", px->fe_counters.p.http.rsp[0]);
} else { } else {
chunk_printf(&msg, ",,,,,,"); chunk_printf(&msg, ",,,,,,");
} }
@ -1872,7 +1878,7 @@ int stats_dump_proxy(struct stream_interface *si, struct proxy *px, struct uri_a
/* requests : req_rate, req_rate_max, req_tot, */ /* requests : req_rate, req_rate_max, req_tot, */
chunk_printf(&msg, "%u,%u,%lld,", chunk_printf(&msg, "%u,%u,%lld,",
read_freq_ctr(&px->fe_req_per_sec), read_freq_ctr(&px->fe_req_per_sec),
px->counters.fe_rps_max, px->counters.cum_fe_req); px->fe_counters.p.http.rps_max, px->fe_counters.p.http.cum_req);
/* errors: cli_aborts, srv_aborts */ /* errors: cli_aborts, srv_aborts */
chunk_printf(&msg, ",,"); chunk_printf(&msg, ",,");
@ -2485,15 +2491,15 @@ int stats_dump_proxy(struct stream_interface *si, struct proxy *px, struct uri_a
(uri->flags & ST_SHLGNDS)?"<u>":"", (uri->flags & ST_SHLGNDS)?"<u>":"",
px->id, px->id, px->id, px->id,
(uri->flags & ST_SHLGNDS)?"</u>":"", (uri->flags & ST_SHLGNDS)?"</u>":"",
U2H0(px->nbpend) /* or px->totpend ? */, U2H1(px->counters.nbpend_max), U2H0(px->nbpend) /* or px->totpend ? */, U2H1(px->be_counters.nbpend_max),
U2H2(read_freq_ctr(&px->be_sess_per_sec)), U2H3(px->counters.be_sps_max)); U2H2(read_freq_ctr(&px->be_sess_per_sec)), U2H3(px->be_counters.sps_max));
chunk_printf(&msg, chunk_printf(&msg,
/* sessions: current, max, limit */ /* sessions: current, max, limit */
"<td>%s</td><td>%s</td><td>%s</td>" "<td>%s</td><td>%s</td><td>%s</td>"
"<td" "<td"
"", "",
U2H2(px->beconn), U2H3(px->counters.beconn_max), U2H4(px->fullconn)); U2H2(px->beconn), U2H3(px->be_counters.conn_max), U2H4(px->fullconn));
/* http response (via td title): 1xx, 2xx, 3xx, 4xx, 5xx, other */ /* http response (via td title): 1xx, 2xx, 3xx, 4xx, 5xx, other */
if (px->mode == PR_MODE_HTTP) { if (px->mode == PR_MODE_HTTP) {
@ -2502,9 +2508,9 @@ int stats_dump_proxy(struct stream_interface *si, struct proxy *px, struct uri_a
chunk_printf(&msg, " title=\"rsp codes:"); chunk_printf(&msg, " title=\"rsp codes:");
for (i = 1; i < 6; i++) for (i = 1; i < 6; i++)
chunk_printf(&msg, " %dxx=%lld", i, px->counters.be.http.rsp[i]); chunk_printf(&msg, " %dxx=%lld", i, px->be_counters.p.http.rsp[i]);
chunk_printf(&msg, " other=%lld\"", px->counters.be.http.rsp[0]); chunk_printf(&msg, " other=%lld\"", px->be_counters.p.http.rsp[0]);
} }
chunk_printf(&msg, chunk_printf(&msg,
@ -2514,10 +2520,10 @@ int stats_dump_proxy(struct stream_interface *si, struct proxy *px, struct uri_a
"<td>%s</td><td>%s</td>" "<td>%s</td><td>%s</td>"
"", "",
(px->mode == PR_MODE_HTTP)?"<u>":"", (px->mode == PR_MODE_HTTP)?"<u>":"",
U2H6(px->counters.cum_beconn), U2H6(px->be_counters.cum_conn),
(px->mode == PR_MODE_HTTP)?"</u>":"", (px->mode == PR_MODE_HTTP)?"</u>":"",
U2H7(px->counters.cum_lbconn), U2H7(px->be_counters.cum_lbconn),
U2H8(px->counters.bytes_in), U2H9(px->counters.bytes_out)); U2H8(px->be_counters.bytes_in), U2H9(px->be_counters.bytes_out));
chunk_printf(&msg, chunk_printf(&msg,
/* denied: req, resp */ /* denied: req, resp */
@ -2535,12 +2541,12 @@ int stats_dump_proxy(struct stream_interface *si, struct proxy *px, struct uri_a
"<td class=ac>%s %s</td><td class=ac>&nbsp;</td><td class=ac>%d</td>" "<td class=ac>%s %s</td><td class=ac>&nbsp;</td><td class=ac>%d</td>"
"<td class=ac>%d</td><td class=ac>%d</td>" "<td class=ac>%d</td><td class=ac>%d</td>"
"", "",
U2H0(px->counters.denied_req), U2H1(px->counters.denied_resp), U2H0(px->be_counters.denied_req), U2H1(px->be_counters.denied_resp),
U2H2(px->counters.failed_conns), U2H2(px->be_counters.failed_conns),
px->counters.cli_aborts, px->be_counters.cli_aborts,
px->counters.srv_aborts, px->be_counters.srv_aborts,
U2H5(px->counters.failed_resp), U2H5(px->be_counters.failed_resp),
px->counters.retries, px->counters.redispatches, px->be_counters.retries, px->be_counters.redispatches,
human_time(now.tv_sec - px->last_change, 1), human_time(now.tv_sec - px->last_change, 1),
(px->lbprm.tot_weight > 0 || !px->srv) ? "UP" : (px->lbprm.tot_weight > 0 || !px->srv) ? "UP" :
"<font color=\"red\"><b>DOWN</b></font>", "<font color=\"red\"><b>DOWN</b></font>",
@ -2586,30 +2592,30 @@ int stats_dump_proxy(struct stream_interface *si, struct proxy *px, struct uri_a
/* check_status, check_code, check_duration */ /* check_status, check_code, check_duration */
",,,", ",,,",
px->id, px->id,
px->nbpend /* or px->totpend ? */, px->counters.nbpend_max, px->nbpend /* or px->totpend ? */, px->be_counters.nbpend_max,
px->beconn, px->counters.beconn_max, px->fullconn, px->counters.cum_beconn, px->beconn, px->be_counters.conn_max, px->fullconn, px->be_counters.cum_conn,
px->counters.bytes_in, px->counters.bytes_out, px->be_counters.bytes_in, px->be_counters.bytes_out,
px->counters.denied_req, px->counters.denied_resp, px->be_counters.denied_req, px->be_counters.denied_resp,
px->counters.failed_conns, px->counters.failed_resp, px->be_counters.failed_conns, px->be_counters.failed_resp,
px->counters.retries, px->counters.redispatches, px->be_counters.retries, px->be_counters.redispatches,
(px->lbprm.tot_weight > 0 || !px->srv) ? "UP" : "DOWN", (px->lbprm.tot_weight > 0 || !px->srv) ? "UP" : "DOWN",
(px->lbprm.tot_weight * px->lbprm.wmult + px->lbprm.wdiv - 1) / px->lbprm.wdiv, (px->lbprm.tot_weight * px->lbprm.wmult + px->lbprm.wdiv - 1) / px->lbprm.wdiv,
px->srv_act, px->srv_bck, px->srv_act, px->srv_bck,
px->down_trans, (int)(now.tv_sec - px->last_change), px->down_trans, (int)(now.tv_sec - px->last_change),
px->srv?be_downtime(px):0, px->srv?be_downtime(px):0,
relative_pid, px->uuid, relative_pid, px->uuid,
px->counters.cum_lbconn, STATS_TYPE_BE, px->be_counters.cum_lbconn, STATS_TYPE_BE,
read_freq_ctr(&px->be_sess_per_sec), read_freq_ctr(&px->be_sess_per_sec),
px->counters.be_sps_max); px->be_counters.sps_max);
/* http response: 1xx, 2xx, 3xx, 4xx, 5xx, other */ /* http response: 1xx, 2xx, 3xx, 4xx, 5xx, other */
if (px->mode == PR_MODE_HTTP) { if (px->mode == PR_MODE_HTTP) {
int i; int i;
for (i=1; i<6; i++) for (i=1; i<6; i++)
chunk_printf(&msg, "%lld,", px->counters.be.http.rsp[i]); chunk_printf(&msg, "%lld,", px->be_counters.p.http.rsp[i]);
chunk_printf(&msg, "%lld,", px->counters.be.http.rsp[0]); chunk_printf(&msg, "%lld,", px->be_counters.p.http.rsp[0]);
} else { } else {
chunk_printf(&msg, ",,,,,,"); chunk_printf(&msg, ",,,,,,");
} }
@ -2622,7 +2628,7 @@ int stats_dump_proxy(struct stream_interface *si, struct proxy *px, struct uri_a
/* errors: cli_aborts, srv_aborts */ /* errors: cli_aborts, srv_aborts */
chunk_printf(&msg, "%lld,%lld,", chunk_printf(&msg, "%lld,%lld,",
px->counters.cli_aborts, px->counters.srv_aborts); px->be_counters.cli_aborts, px->be_counters.srv_aborts);
/* finish with EOL */ /* finish with EOL */
chunk_printf(&msg, "\n"); chunk_printf(&msg, "\n");

View File

@ -449,7 +449,7 @@ int frontend_decode_proxy_request(struct session *s, struct buffer *req, int an_
buffer_abort(s->rep); buffer_abort(s->rep);
req->analysers = 0; req->analysers = 0;
s->fe->counters.failed_req++; s->fe->fe_counters.failed_req++;
if (s->listener->counters) if (s->listener->counters)
s->listener->counters->failed_req++; s->listener->counters->failed_req++;

View File

@ -1,6 +1,6 @@
/* /*
* HA-Proxy : High Availability-enabled HTTP/TCP proxy * HA-Proxy : High Availability-enabled HTTP/TCP proxy
* Copyright 2000-2010 Willy Tarreau <w@1wt.eu>. * Copyright 2000-2011 Willy Tarreau <w@1wt.eu>.
* *
* This program is free software; you can redistribute it and/or * This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License * modify it under the terms of the GNU General Public License
@ -310,19 +310,19 @@ void sig_dump_state(struct sig_handler *sh)
snprintf(trash, sizeof(trash), snprintf(trash, sizeof(trash),
"SIGHUP: Proxy %s has no servers. Conn: act(FE+BE): %d+%d, %d pend (%d unass), tot(FE+BE): %lld+%lld.", "SIGHUP: Proxy %s has no servers. Conn: act(FE+BE): %d+%d, %d pend (%d unass), tot(FE+BE): %lld+%lld.",
p->id, p->id,
p->feconn, p->beconn, p->totpend, p->nbpend, p->counters.cum_feconn, p->counters.cum_beconn); p->feconn, p->beconn, p->totpend, p->nbpend, p->fe_counters.cum_conn, p->be_counters.cum_conn);
} else if (p->srv_act == 0) { } else if (p->srv_act == 0) {
snprintf(trash, sizeof(trash), snprintf(trash, sizeof(trash),
"SIGHUP: Proxy %s %s ! Conn: act(FE+BE): %d+%d, %d pend (%d unass), tot(FE+BE): %lld+%lld.", "SIGHUP: Proxy %s %s ! Conn: act(FE+BE): %d+%d, %d pend (%d unass), tot(FE+BE): %lld+%lld.",
p->id, p->id,
(p->srv_bck) ? "is running on backup servers" : "has no server available", (p->srv_bck) ? "is running on backup servers" : "has no server available",
p->feconn, p->beconn, p->totpend, p->nbpend, p->counters.cum_feconn, p->counters.cum_beconn); p->feconn, p->beconn, p->totpend, p->nbpend, p->fe_counters.cum_conn, p->be_counters.cum_conn);
} else { } else {
snprintf(trash, sizeof(trash), snprintf(trash, sizeof(trash),
"SIGHUP: Proxy %s has %d active servers and %d backup servers available." "SIGHUP: Proxy %s has %d active servers and %d backup servers available."
" Conn: act(FE+BE): %d+%d, %d pend (%d unass), tot(FE+BE): %lld+%lld.", " Conn: act(FE+BE): %d+%d, %d pend (%d unass), tot(FE+BE): %lld+%lld.",
p->id, p->srv_act, p->srv_bck, p->id, p->srv_act, p->srv_bck,
p->feconn, p->beconn, p->totpend, p->nbpend, p->counters.cum_feconn, p->counters.cum_beconn); p->feconn, p->beconn, p->totpend, p->nbpend, p->fe_counters.cum_conn, p->be_counters.cum_conn);
} }
Warning("%s\n", trash); Warning("%s\n", trash);
send_log(p, LOG_NOTICE, "%s\n", trash); send_log(p, LOG_NOTICE, "%s\n", trash);

View File

@ -2530,7 +2530,7 @@ int http_wait_for_request(struct session *s, struct buffer *req, int an_bit)
session_inc_http_req_ctr(s); session_inc_http_req_ctr(s);
proxy_inc_fe_req_ctr(s->fe); proxy_inc_fe_req_ctr(s->fe);
s->fe->counters.failed_req++; s->fe->fe_counters.failed_req++;
if (s->listener->counters) if (s->listener->counters)
s->listener->counters->failed_req++; s->listener->counters->failed_req++;
@ -2559,7 +2559,7 @@ int http_wait_for_request(struct session *s, struct buffer *req, int an_bit)
session_inc_http_req_ctr(s); session_inc_http_req_ctr(s);
proxy_inc_fe_req_ctr(s->fe); proxy_inc_fe_req_ctr(s->fe);
s->fe->counters.failed_req++; s->fe->fe_counters.failed_req++;
if (s->listener->counters) if (s->listener->counters)
s->listener->counters->failed_req++; s->listener->counters->failed_req++;
@ -2586,7 +2586,7 @@ int http_wait_for_request(struct session *s, struct buffer *req, int an_bit)
session_inc_http_err_ctr(s); session_inc_http_err_ctr(s);
session_inc_http_req_ctr(s); session_inc_http_req_ctr(s);
proxy_inc_fe_req_ctr(s->fe); proxy_inc_fe_req_ctr(s->fe);
s->fe->counters.failed_req++; s->fe->fe_counters.failed_req++;
if (s->listener->counters) if (s->listener->counters)
s->listener->counters->failed_req++; s->listener->counters->failed_req++;
@ -2862,7 +2862,7 @@ int http_wait_for_request(struct session *s, struct buffer *req, int an_bit)
txn->status = 400; txn->status = 400;
stream_int_retnclose(req->prod, error_message(s, HTTP_ERR_400)); stream_int_retnclose(req->prod, error_message(s, HTTP_ERR_400));
s->fe->counters.failed_req++; s->fe->fe_counters.failed_req++;
if (s->listener->counters) if (s->listener->counters)
s->listener->counters->failed_req++; s->listener->counters->failed_req++;
@ -3433,7 +3433,7 @@ int http_process_req_common(struct session *s, struct buffer *req, int an_bit, s
txn->status = 400; txn->status = 400;
stream_int_retnclose(req->prod, error_message(s, HTTP_ERR_400)); stream_int_retnclose(req->prod, error_message(s, HTTP_ERR_400));
s->fe->counters.failed_req++; s->fe->fe_counters.failed_req++;
if (s->listener->counters) if (s->listener->counters)
s->listener->counters->failed_req++; s->listener->counters->failed_req++;
@ -3683,7 +3683,7 @@ int http_process_request(struct session *s, struct buffer *req, int an_bit)
req->analysers = 0; req->analysers = 0;
stream_int_retnclose(req->prod, error_message(s, HTTP_ERR_400)); stream_int_retnclose(req->prod, error_message(s, HTTP_ERR_400));
s->fe->counters.failed_req++; s->fe->fe_counters.failed_req++;
if (s->listener->counters) if (s->listener->counters)
s->listener->counters->failed_req++; s->listener->counters->failed_req++;
@ -3727,7 +3727,7 @@ int http_process_tarpit(struct session *s, struct buffer *req, int an_bit)
req->analysers = 0; req->analysers = 0;
req->analyse_exp = TICK_ETERNITY; req->analyse_exp = TICK_ETERNITY;
s->fe->counters.failed_req++; s->fe->fe_counters.failed_req++;
if (s->listener->counters) if (s->listener->counters)
s->listener->counters->failed_req++; s->listener->counters->failed_req++;
@ -3867,7 +3867,7 @@ int http_process_request_body(struct session *s, struct buffer *req, int an_bit)
return_err_msg: return_err_msg:
req->analysers = 0; req->analysers = 0;
s->fe->counters.failed_req++; s->fe->fe_counters.failed_req++;
if (s->listener->counters) if (s->listener->counters)
s->listener->counters->failed_req++; s->listener->counters->failed_req++;
return 0; return 0;
@ -3906,11 +3906,11 @@ void http_end_txn_clean_session(struct session *s)
n = 0; n = 0;
if (s->fe->mode == PR_MODE_HTTP) if (s->fe->mode == PR_MODE_HTTP)
s->fe->counters.fe.http.rsp[n]++; s->fe->fe_counters.p.http.rsp[n]++;
if ((s->flags & SN_BE_ASSIGNED) && if ((s->flags & SN_BE_ASSIGNED) &&
(s->be->mode == PR_MODE_HTTP)) (s->be->mode == PR_MODE_HTTP))
s->be->counters.be.http.rsp[n]++; s->be->be_counters.p.http.rsp[n]++;
} }
/* don't count other requests' data */ /* don't count other requests' data */
@ -4232,7 +4232,7 @@ int http_sync_res_state(struct session *s)
} }
else if (buf->flags & BF_SHUTW) { else if (buf->flags & BF_SHUTW) {
txn->rsp.msg_state = HTTP_MSG_ERROR; txn->rsp.msg_state = HTTP_MSG_ERROR;
s->be->counters.cli_aborts++; s->be->be_counters.cli_aborts++;
if (target_srv(&s->target)) if (target_srv(&s->target))
target_srv(&s->target)->counters.cli_aborts++; target_srv(&s->target)->counters.cli_aborts++;
goto wait_other_side; goto wait_other_side;
@ -4513,9 +4513,8 @@ int http_request_forward_body(struct session *s, struct buffer *req, int an_bit)
s->flags |= SN_FINST_D; s->flags |= SN_FINST_D;
} }
s->fe->counters.cli_aborts++; s->fe->fe_counters.cli_aborts++;
if (s->fe != s->be) s->be->be_counters.cli_aborts++;
s->be->counters.cli_aborts++;
if (target_srv(&s->target)) if (target_srv(&s->target))
target_srv(&s->target)->counters.cli_aborts++; target_srv(&s->target)->counters.cli_aborts++;
@ -4536,7 +4535,7 @@ int http_request_forward_body(struct session *s, struct buffer *req, int an_bit)
return 0; return 0;
return_bad_req: /* let's centralize all bad requests */ return_bad_req: /* let's centralize all bad requests */
s->fe->counters.failed_req++; s->fe->fe_counters.failed_req++;
if (s->listener->counters) if (s->listener->counters)
s->listener->counters->failed_req++; s->listener->counters->failed_req++;
return_bad_req_stats_ok: return_bad_req_stats_ok:
@ -4573,9 +4572,8 @@ int http_request_forward_body(struct session *s, struct buffer *req, int an_bit)
req->analysers = 0; req->analysers = 0;
s->rep->analysers = 0; /* we're in data phase, we want to abort both directions */ s->rep->analysers = 0; /* we're in data phase, we want to abort both directions */
s->fe->counters.srv_aborts++; s->fe->fe_counters.srv_aborts++;
if (s->fe != s->be) s->be->be_counters.srv_aborts++;
s->be->counters.srv_aborts++;
if (target_srv(&s->target)) if (target_srv(&s->target))
target_srv(&s->target)->counters.srv_aborts++; target_srv(&s->target)->counters.srv_aborts++;
@ -4702,7 +4700,7 @@ int http_wait_for_response(struct session *s, struct buffer *rep, int an_bit)
if (msg->msg_state == HTTP_MSG_ERROR || msg->err_pos >= 0) if (msg->msg_state == HTTP_MSG_ERROR || msg->err_pos >= 0)
http_capture_bad_message(&s->be->invalid_rep, s, rep, msg, msg->msg_state, s->fe); http_capture_bad_message(&s->be->invalid_rep, s, rep, msg, msg->msg_state, s->fe);
s->be->counters.failed_resp++; s->be->be_counters.failed_resp++;
if (target_srv(&s->target)) { if (target_srv(&s->target)) {
target_srv(&s->target)->counters.failed_resp++; target_srv(&s->target)->counters.failed_resp++;
health_adjust(target_srv(&s->target), HANA_STATUS_HTTP_HDRRSP); health_adjust(target_srv(&s->target), HANA_STATUS_HTTP_HDRRSP);
@ -4733,7 +4731,7 @@ int http_wait_for_response(struct session *s, struct buffer *rep, int an_bit)
if (msg->err_pos >= 0) if (msg->err_pos >= 0)
http_capture_bad_message(&s->be->invalid_rep, s, rep, msg, msg->msg_state, s->fe); http_capture_bad_message(&s->be->invalid_rep, s, rep, msg, msg->msg_state, s->fe);
s->be->counters.failed_resp++; s->be->be_counters.failed_resp++;
if (target_srv(&s->target)) { if (target_srv(&s->target)) {
target_srv(&s->target)->counters.failed_resp++; target_srv(&s->target)->counters.failed_resp++;
health_adjust(target_srv(&s->target), HANA_STATUS_HTTP_READ_ERROR); health_adjust(target_srv(&s->target), HANA_STATUS_HTTP_READ_ERROR);
@ -4758,7 +4756,7 @@ int http_wait_for_response(struct session *s, struct buffer *rep, int an_bit)
if (msg->err_pos >= 0) if (msg->err_pos >= 0)
http_capture_bad_message(&s->be->invalid_rep, s, rep, msg, msg->msg_state, s->fe); http_capture_bad_message(&s->be->invalid_rep, s, rep, msg, msg->msg_state, s->fe);
s->be->counters.failed_resp++; s->be->be_counters.failed_resp++;
if (target_srv(&s->target)) { if (target_srv(&s->target)) {
target_srv(&s->target)->counters.failed_resp++; target_srv(&s->target)->counters.failed_resp++;
health_adjust(target_srv(&s->target), HANA_STATUS_HTTP_READ_TIMEOUT); health_adjust(target_srv(&s->target), HANA_STATUS_HTTP_READ_TIMEOUT);
@ -4783,7 +4781,7 @@ int http_wait_for_response(struct session *s, struct buffer *rep, int an_bit)
if (msg->err_pos >= 0) if (msg->err_pos >= 0)
http_capture_bad_message(&s->be->invalid_rep, s, rep, msg, msg->msg_state, s->fe); http_capture_bad_message(&s->be->invalid_rep, s, rep, msg, msg->msg_state, s->fe);
s->be->counters.failed_resp++; s->be->be_counters.failed_resp++;
if (target_srv(&s->target)) { if (target_srv(&s->target)) {
target_srv(&s->target)->counters.failed_resp++; target_srv(&s->target)->counters.failed_resp++;
health_adjust(target_srv(&s->target), HANA_STATUS_HTTP_BROKEN_PIPE); health_adjust(target_srv(&s->target), HANA_STATUS_HTTP_BROKEN_PIPE);
@ -4808,7 +4806,7 @@ int http_wait_for_response(struct session *s, struct buffer *rep, int an_bit)
if (msg->err_pos >= 0) if (msg->err_pos >= 0)
http_capture_bad_message(&s->be->invalid_rep, s, rep, msg, msg->msg_state, s->fe); http_capture_bad_message(&s->be->invalid_rep, s, rep, msg, msg->msg_state, s->fe);
s->be->counters.failed_resp++; s->be->be_counters.failed_resp++;
rep->analysers = 0; rep->analysers = 0;
buffer_auto_close(rep); buffer_auto_close(rep);
@ -5130,7 +5128,7 @@ int http_process_res_common(struct session *t, struct buffer *rep, int an_bit, s
target_srv(&t->target)->counters.failed_resp++; target_srv(&t->target)->counters.failed_resp++;
health_adjust(target_srv(&t->target), HANA_STATUS_HTTP_RSP); health_adjust(target_srv(&t->target), HANA_STATUS_HTTP_RSP);
} }
cur_proxy->counters.failed_resp++; t->be->be_counters.failed_resp++;
return_srv_prx_502: return_srv_prx_502:
rep->analysers = 0; rep->analysers = 0;
txn->status = 502; txn->status = 502;
@ -5150,7 +5148,8 @@ int http_process_res_common(struct session *t, struct buffer *rep, int an_bit, s
if (target_srv(&t->target)) if (target_srv(&t->target))
target_srv(&t->target)->counters.failed_secu++; target_srv(&t->target)->counters.failed_secu++;
cur_proxy->counters.denied_resp++; t->be->be_counters.denied_resp++;
t->fe->fe_counters.denied_resp++;
if (t->listener->counters) if (t->listener->counters)
t->listener->counters->denied_resp++; t->listener->counters->denied_resp++;
@ -5302,7 +5301,8 @@ int http_process_res_common(struct session *t, struct buffer *rep, int an_bit, s
if (target_srv(&t->target)) if (target_srv(&t->target))
target_srv(&t->target)->counters.failed_secu++; target_srv(&t->target)->counters.failed_secu++;
cur_proxy->counters.denied_resp++; t->be->be_counters.denied_resp++;
t->fe->fe_counters.denied_resp++;
if (t->listener->counters) if (t->listener->counters)
t->listener->counters->denied_resp++; t->listener->counters->denied_resp++;
@ -5527,7 +5527,7 @@ int http_response_forward_body(struct session *s, struct buffer *res, int an_bit
if (res->flags & BF_SHUTR) { if (res->flags & BF_SHUTR) {
if (!(s->flags & SN_ERR_MASK)) if (!(s->flags & SN_ERR_MASK))
s->flags |= SN_ERR_SRVCL; s->flags |= SN_ERR_SRVCL;
s->be->counters.srv_aborts++; s->be->be_counters.srv_aborts++;
if (target_srv(&s->target)) if (target_srv(&s->target))
target_srv(&s->target)->counters.srv_aborts++; target_srv(&s->target)->counters.srv_aborts++;
goto return_bad_res_stats_ok; goto return_bad_res_stats_ok;
@ -5565,7 +5565,7 @@ int http_response_forward_body(struct session *s, struct buffer *res, int an_bit
return 0; return 0;
return_bad_res: /* let's centralize all bad responses */ return_bad_res: /* let's centralize all bad responses */
s->be->counters.failed_resp++; s->be->be_counters.failed_resp++;
if (target_srv(&s->target)) if (target_srv(&s->target))
target_srv(&s->target)->counters.failed_resp++; target_srv(&s->target)->counters.failed_resp++;
@ -5591,9 +5591,8 @@ int http_response_forward_body(struct session *s, struct buffer *res, int an_bit
res->analysers = 0; res->analysers = 0;
s->req->analysers = 0; /* we're in data phase, we want to abort both directions */ s->req->analysers = 0; /* we're in data phase, we want to abort both directions */
s->fe->counters.cli_aborts++; s->fe->fe_counters.cli_aborts++;
if (s->fe != s->be) s->be->be_counters.cli_aborts++;
s->be->counters.cli_aborts++;
if (target_srv(&s->target)) if (target_srv(&s->target))
target_srv(&s->target)->counters.cli_aborts++; target_srv(&s->target)->counters.cli_aborts++;
@ -5677,7 +5676,9 @@ int apply_filter_to_req_headers(struct session *t, struct buffer *req, struct hd
txn->flags |= TX_CLDENY; txn->flags |= TX_CLDENY;
last_hdr = 1; last_hdr = 1;
t->be->counters.denied_req++; t->fe->fe_counters.denied_req++;
if (t->fe != t->be)
t->be->be_counters.denied_req++;
if (t->listener->counters) if (t->listener->counters)
t->listener->counters->denied_req++; t->listener->counters->denied_req++;
@ -5687,7 +5688,9 @@ int apply_filter_to_req_headers(struct session *t, struct buffer *req, struct hd
txn->flags |= TX_CLTARPIT; txn->flags |= TX_CLTARPIT;
last_hdr = 1; last_hdr = 1;
t->be->counters.denied_req++; t->fe->fe_counters.denied_req++;
if (t->fe != t->be)
t->be->be_counters.denied_req++;
if (t->listener->counters) if (t->listener->counters)
t->listener->counters->denied_req++; t->listener->counters->denied_req++;
@ -5796,7 +5799,9 @@ int apply_filter_to_req_line(struct session *t, struct buffer *req, struct hdr_e
case ACT_DENY: case ACT_DENY:
txn->flags |= TX_CLDENY; txn->flags |= TX_CLDENY;
t->be->counters.denied_req++; t->fe->fe_counters.denied_req++;
if (t->fe != t->be)
t->be->be_counters.denied_req++;
if (t->listener->counters) if (t->listener->counters)
t->listener->counters->denied_req++; t->listener->counters->denied_req++;
@ -5806,7 +5811,9 @@ int apply_filter_to_req_line(struct session *t, struct buffer *req, struct hdr_e
case ACT_TARPIT: case ACT_TARPIT:
txn->flags |= TX_CLTARPIT; txn->flags |= TX_CLTARPIT;
t->be->counters.denied_req++; t->fe->fe_counters.denied_req++;
if (t->fe != t->be)
t->be->be_counters.denied_req++;
if (t->listener->counters) if (t->listener->counters)
t->listener->counters->denied_req++; t->listener->counters->denied_req++;

View File

@ -726,7 +726,8 @@ int tcp_inspect_request(struct session *s, struct buffer *req, int an_bit)
buffer_abort(s->rep); buffer_abort(s->rep);
req->analysers = 0; req->analysers = 0;
s->be->counters.denied_req++; s->be->be_counters.denied_req++;
s->fe->fe_counters.denied_req++;
if (s->listener->counters) if (s->listener->counters)
s->listener->counters->denied_req++; s->listener->counters->denied_req++;
@ -842,7 +843,8 @@ int tcp_inspect_response(struct session *s, struct buffer *rep, int an_bit)
buffer_abort(s->req); buffer_abort(s->req);
rep->analysers = 0; rep->analysers = 0;
s->be->counters.denied_resp++; s->be->be_counters.denied_resp++;
s->fe->fe_counters.denied_resp++;
if (s->listener->counters) if (s->listener->counters)
s->listener->counters->denied_resp++; s->listener->counters->denied_resp++;
@ -894,7 +896,7 @@ int tcp_exec_req_rules(struct session *s)
if (ret) { if (ret) {
/* we have a matching rule. */ /* we have a matching rule. */
if (rule->action == TCP_ACT_REJECT) { if (rule->action == TCP_ACT_REJECT) {
s->fe->counters.denied_conn++; s->fe->fe_counters.denied_conn++;
if (s->listener->counters) if (s->listener->counters)
s->listener->counters->denied_conn++; s->listener->counters->denied_conn++;

View File

@ -536,9 +536,9 @@ void maintain_proxies(int *next)
t = tick_remain(now_ms, p->stop_time); t = tick_remain(now_ms, p->stop_time);
if (t == 0) { if (t == 0) {
Warning("Proxy %s stopped (FE: %lld conns, BE: %lld conns).\n", Warning("Proxy %s stopped (FE: %lld conns, BE: %lld conns).\n",
p->id, p->counters.cum_feconn, p->counters.cum_beconn); p->id, p->fe_counters.cum_conn, p->be_counters.cum_conn);
send_log(p, LOG_WARNING, "Proxy %s stopped (FE: %lld conns, BE: %lld conns).\n", send_log(p, LOG_WARNING, "Proxy %s stopped (FE: %lld conns, BE: %lld conns).\n",
p->id, p->counters.cum_feconn, p->counters.cum_beconn); p->id, p->fe_counters.cum_conn, p->be_counters.cum_conn);
stop_proxy(p); stop_proxy(p);
/* try to free more memory */ /* try to free more memory */
pool_gc2(); pool_gc2();
@ -766,8 +766,8 @@ int session_set_backend(struct session *s, struct proxy *be)
return 1; return 1;
s->be = be; s->be = be;
be->beconn++; be->beconn++;
if (be->beconn > be->counters.beconn_max) if (be->beconn > be->be_counters.conn_max)
be->counters.beconn_max = be->beconn; be->be_counters.conn_max = be->beconn;
proxy_inc_be_ctr(be); proxy_inc_be_ctr(be);
/* assign new parameters to the session from the new backend */ /* assign new parameters to the session from the new backend */

View File

@ -159,8 +159,8 @@ struct pendconn *pendconn_add(struct session *sess)
LIST_ADDQ(&sess->be->pendconns, &p->list); LIST_ADDQ(&sess->be->pendconns, &p->list);
sess->be->nbpend++; sess->be->nbpend++;
sess->logs.prx_queue_size += sess->be->nbpend; sess->logs.prx_queue_size += sess->be->nbpend;
if (sess->be->nbpend > sess->be->counters.nbpend_max) if (sess->be->nbpend > sess->be->be_counters.nbpend_max)
sess->be->counters.nbpend_max = sess->be->nbpend; sess->be->be_counters.nbpend_max = sess->be->nbpend;
} }
sess->be->totpend++; sess->be->totpend++;
return p; return p;

View File

@ -130,8 +130,8 @@ int session_accept(struct listener *l, int cfd, struct sockaddr_storage *addr)
} }
/* This session was accepted, count it now */ /* This session was accepted, count it now */
if (p->feconn > p->counters.feconn_max) if (p->feconn > p->fe_counters.conn_max)
p->counters.feconn_max = p->feconn; p->fe_counters.conn_max = p->feconn;
proxy_inc_fe_sess_ctr(l, p); proxy_inc_fe_sess_ctr(l, p);
if (s->stkctr1_entry) { if (s->stkctr1_entry) {
@ -410,10 +410,9 @@ void session_process_counters(struct session *s)
bytes = s->req->total - s->logs.bytes_in; bytes = s->req->total - s->logs.bytes_in;
s->logs.bytes_in = s->req->total; s->logs.bytes_in = s->req->total;
if (bytes) { if (bytes) {
s->fe->counters.bytes_in += bytes; s->fe->fe_counters.bytes_in += bytes;
if (s->be != s->fe) s->be->be_counters.bytes_in += bytes;
s->be->counters.bytes_in += bytes;
if (target_srv(&s->target)) if (target_srv(&s->target))
target_srv(&s->target)->counters.bytes_in += bytes; target_srv(&s->target)->counters.bytes_in += bytes;
@ -461,10 +460,9 @@ void session_process_counters(struct session *s)
bytes = s->rep->total - s->logs.bytes_out; bytes = s->rep->total - s->logs.bytes_out;
s->logs.bytes_out = s->rep->total; s->logs.bytes_out = s->rep->total;
if (bytes) { if (bytes) {
s->fe->counters.bytes_out += bytes; s->fe->fe_counters.bytes_out += bytes;
if (s->be != s->fe) s->be->be_counters.bytes_out += bytes;
s->be->counters.bytes_out += bytes;
if (target_srv(&s->target)) if (target_srv(&s->target))
target_srv(&s->target)->counters.bytes_out += bytes; target_srv(&s->target)->counters.bytes_out += bytes;
@ -606,7 +604,7 @@ int sess_update_st_cer(struct session *s, struct stream_interface *si)
if (target_srv(&s->target)) if (target_srv(&s->target))
target_srv(&s->target)->counters.failed_conns++; target_srv(&s->target)->counters.failed_conns++;
s->be->counters.failed_conns++; s->be->be_counters.failed_conns++;
sess_change_server(s, NULL); sess_change_server(s, NULL);
if (may_dequeue_tasks(target_srv(&s->target), s->be)) if (may_dequeue_tasks(target_srv(&s->target), s->be))
process_srv_queue(target_srv(&s->target)); process_srv_queue(target_srv(&s->target));
@ -639,7 +637,7 @@ int sess_update_st_cer(struct session *s, struct stream_interface *si)
} else { } else {
if (target_srv(&s->target)) if (target_srv(&s->target))
target_srv(&s->target)->counters.retries++; target_srv(&s->target)->counters.retries++;
s->be->counters.retries++; s->be->be_counters.retries++;
si->state = SI_ST_ASS; si->state = SI_ST_ASS;
} }
@ -743,7 +741,7 @@ void sess_update_stream_int(struct session *s, struct stream_interface *si)
srv_inc_sess_ctr(srv); srv_inc_sess_ctr(srv);
if (srv) if (srv)
srv->counters.failed_conns++; srv->counters.failed_conns++;
s->be->counters.failed_conns++; s->be->be_counters.failed_conns++;
/* release other sessions waiting for this server */ /* release other sessions waiting for this server */
sess_change_server(s, NULL); sess_change_server(s, NULL);
@ -799,7 +797,7 @@ void sess_update_stream_int(struct session *s, struct stream_interface *si)
s->logs.t_queue = tv_ms_elapsed(&s->logs.tv_accept, &now); s->logs.t_queue = tv_ms_elapsed(&s->logs.tv_accept, &now);
if (srv) if (srv)
srv->counters.failed_conns++; srv->counters.failed_conns++;
s->be->counters.failed_conns++; s->be->be_counters.failed_conns++;
si->shutr(si); si->shutr(si);
si->shutw(si); si->shutw(si);
si->ob->flags |= BF_WRITE_TIMEOUT; si->ob->flags |= BF_WRITE_TIMEOUT;
@ -1279,7 +1277,8 @@ struct task *process_session(struct task *t)
s->si[0].shutw(&s->si[0]); s->si[0].shutw(&s->si[0]);
stream_int_report_error(&s->si[0]); stream_int_report_error(&s->si[0]);
if (!(s->req->analysers) && !(s->rep->analysers)) { if (!(s->req->analysers) && !(s->rep->analysers)) {
s->be->counters.cli_aborts++; s->be->be_counters.cli_aborts++;
s->fe->fe_counters.cli_aborts++;
if (srv) if (srv)
srv->counters.cli_aborts++; srv->counters.cli_aborts++;
if (!(s->flags & SN_ERR_MASK)) if (!(s->flags & SN_ERR_MASK))
@ -1295,11 +1294,12 @@ struct task *process_session(struct task *t)
s->si[1].shutr(&s->si[1]); s->si[1].shutr(&s->si[1]);
s->si[1].shutw(&s->si[1]); s->si[1].shutw(&s->si[1]);
stream_int_report_error(&s->si[1]); stream_int_report_error(&s->si[1]);
s->be->counters.failed_resp++; s->be->be_counters.failed_resp++;
if (srv) if (srv)
srv->counters.failed_resp++; srv->counters.failed_resp++;
if (!(s->req->analysers) && !(s->rep->analysers)) { if (!(s->req->analysers) && !(s->rep->analysers)) {
s->be->counters.srv_aborts++; s->be->be_counters.srv_aborts++;
s->fe->fe_counters.srv_aborts++;
if (srv) if (srv)
srv->counters.srv_aborts++; srv->counters.srv_aborts++;
if (!(s->flags & SN_ERR_MASK)) if (!(s->flags & SN_ERR_MASK))
@ -1659,25 +1659,29 @@ struct task *process_session(struct task *t)
/* Report it if the client got an error or a read timeout expired */ /* Report it if the client got an error or a read timeout expired */
s->req->analysers = 0; s->req->analysers = 0;
if (s->req->flags & BF_READ_ERROR) { if (s->req->flags & BF_READ_ERROR) {
s->be->counters.cli_aborts++; s->be->be_counters.cli_aborts++;
s->fe->fe_counters.cli_aborts++;
if (srv) if (srv)
srv->counters.cli_aborts++; srv->counters.cli_aborts++;
s->flags |= SN_ERR_CLICL; s->flags |= SN_ERR_CLICL;
} }
else if (s->req->flags & BF_READ_TIMEOUT) { else if (s->req->flags & BF_READ_TIMEOUT) {
s->be->counters.cli_aborts++; s->be->be_counters.cli_aborts++;
s->fe->fe_counters.cli_aborts++;
if (srv) if (srv)
srv->counters.cli_aborts++; srv->counters.cli_aborts++;
s->flags |= SN_ERR_CLITO; s->flags |= SN_ERR_CLITO;
} }
else if (s->req->flags & BF_WRITE_ERROR) { else if (s->req->flags & BF_WRITE_ERROR) {
s->be->counters.srv_aborts++; s->be->be_counters.srv_aborts++;
s->fe->fe_counters.srv_aborts++;
if (srv) if (srv)
srv->counters.srv_aborts++; srv->counters.srv_aborts++;
s->flags |= SN_ERR_SRVCL; s->flags |= SN_ERR_SRVCL;
} }
else { else {
s->be->counters.srv_aborts++; s->be->be_counters.srv_aborts++;
s->fe->fe_counters.srv_aborts++;
if (srv) if (srv)
srv->counters.srv_aborts++; srv->counters.srv_aborts++;
s->flags |= SN_ERR_SRVTO; s->flags |= SN_ERR_SRVTO;
@ -1688,25 +1692,29 @@ struct task *process_session(struct task *t)
/* Report it if the server got an error or a read timeout expired */ /* Report it if the server got an error or a read timeout expired */
s->rep->analysers = 0; s->rep->analysers = 0;
if (s->rep->flags & BF_READ_ERROR) { if (s->rep->flags & BF_READ_ERROR) {
s->be->counters.srv_aborts++; s->be->be_counters.srv_aborts++;
s->fe->fe_counters.srv_aborts++;
if (srv) if (srv)
srv->counters.srv_aborts++; srv->counters.srv_aborts++;
s->flags |= SN_ERR_SRVCL; s->flags |= SN_ERR_SRVCL;
} }
else if (s->rep->flags & BF_READ_TIMEOUT) { else if (s->rep->flags & BF_READ_TIMEOUT) {
s->be->counters.srv_aborts++; s->be->be_counters.srv_aborts++;
s->fe->fe_counters.srv_aborts++;
if (srv) if (srv)
srv->counters.srv_aborts++; srv->counters.srv_aborts++;
s->flags |= SN_ERR_SRVTO; s->flags |= SN_ERR_SRVTO;
} }
else if (s->rep->flags & BF_WRITE_ERROR) { else if (s->rep->flags & BF_WRITE_ERROR) {
s->be->counters.cli_aborts++; s->be->be_counters.cli_aborts++;
s->fe->fe_counters.cli_aborts++;
if (srv) if (srv)
srv->counters.cli_aborts++; srv->counters.cli_aborts++;
s->flags |= SN_ERR_CLICL; s->flags |= SN_ERR_CLICL;
} }
else { else {
s->be->counters.cli_aborts++; s->be->be_counters.cli_aborts++;
s->fe->fe_counters.cli_aborts++;
if (srv) if (srv)
srv->counters.cli_aborts++; srv->counters.cli_aborts++;
s->flags |= SN_ERR_CLITO; s->flags |= SN_ERR_CLITO;
@ -2063,11 +2071,11 @@ struct task *process_session(struct task *t)
n = 0; n = 0;
if (s->fe->mode == PR_MODE_HTTP) if (s->fe->mode == PR_MODE_HTTP)
s->fe->counters.fe.http.rsp[n]++; s->fe->fe_counters.p.http.rsp[n]++;
if ((s->flags & SN_BE_ASSIGNED) && if ((s->flags & SN_BE_ASSIGNED) &&
(s->be->mode == PR_MODE_HTTP)) (s->be->mode == PR_MODE_HTTP))
s->be->counters.be.http.rsp[n]++; s->be->be_counters.p.http.rsp[n]++;
} }
/* let's do a final log if we need it */ /* let's do a final log if we need it */
@ -2120,7 +2128,7 @@ void sess_set_term_flags(struct session *s)
if (!(s->flags & SN_FINST_MASK)) { if (!(s->flags & SN_FINST_MASK)) {
if (s->si[1].state < SI_ST_REQ) { if (s->si[1].state < SI_ST_REQ) {
s->fe->counters.failed_req++; s->fe->fe_counters.failed_req++;
if (s->listener->counters) if (s->listener->counters)
s->listener->counters->failed_req++; s->listener->counters->failed_req++;