/* 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)
{
- fe->counters.cum_feconn++;
+ fe->fe_counters.cum_conn++;
if (l->counters)
l->counters->cum_conn++;
update_freq_ctr(&fe->fe_conn_per_sec, 1);
- if (fe->fe_conn_per_sec.curr_ctr > fe->counters.fe_cps_max)
- fe->counters.fe_cps_max = fe->fe_conn_per_sec.curr_ctr;
+ if (fe->fe_conn_per_sec.curr_ctr > fe->fe_counters.cps_max)
+ fe->fe_counters.cps_max = fe->fe_conn_per_sec.curr_ctr;
}
/* 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)
{
- fe->counters.cum_fesess++;
+ fe->fe_counters.cum_sess++;
if (l->counters)
l->counters->cum_sess++;
update_freq_ctr(&fe->fe_sess_per_sec, 1);
- if (fe->fe_sess_per_sec.curr_ctr > fe->counters.fe_sps_max)
- fe->counters.fe_sps_max = fe->fe_sess_per_sec.curr_ctr;
+ if (fe->fe_sess_per_sec.curr_ctr > fe->fe_counters.sps_max)
+ fe->fe_counters.sps_max = fe->fe_sess_per_sec.curr_ctr;
}
/* increase the number of cumulated connections on the designated backend */
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);
- if (be->be_sess_per_sec.curr_ctr > be->counters.be_sps_max)
- be->counters.be_sps_max = be->be_sess_per_sec.curr_ctr;
+ if (be->be_sess_per_sec.curr_ctr > be->be_counters.sps_max)
+ be->be_counters.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++;
+ fe->fe_counters.p.http.cum_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;
+ if (fe->fe_req_per_sec.curr_ctr > fe->fe_counters.p.http.rps_max)
+ fe->fe_counters.p.http.rps_max = fe->fe_req_per_sec.curr_ctr;
}
#endif /* _PROTO_PROXY_H */
/*
- include/types/counters.h
- This file contains structure declarations for statistics counters.
-
- Copyright 2008-2009 Krzysztof Piotr Oledzki <ole@ans.pl>
-
- This library is free software; you can redistribute it and/or
- modify it under the terms of the GNU Lesser General Public
- 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
- 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
- Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
-*/
+ * include/types/counters.h
+ * This file contains structure declarations for statistics counters.
+ *
+ * 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
+ * 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
+ * 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
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ */
#ifndef _TYPES_COUNTERS_H
#define _TYPES_COUNTERS_H
+/* maybe later we might thing about having a different struct for FE and BE */
struct pxcounters {
- 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_fesess; /* cumulated number of received/accepted connections */
- long long cum_beconn, 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_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_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 failed_req; /* failed requests (eg: invalid or timeout) */
- long long denied_conn; /* denied connection requests (tcp-req rules) */
+ 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) */
+
+ unsigned int cps_max; /* maximum of new connections received per second */
+ unsigned int sps_max; /* maximum of new connections accepted per second (sessions) */
+ unsigned int nbpend_max; /* max number of pending connections with no server assigned yet (BE only) */
+
+ 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 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 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 {
struct {
- long long rsp[6]; /* http response codes */
+ 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 */
} http;
- } fe, be; /* FE and BE 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 */
+ } p; /* protocol-specific stats */
};
struct licounters {
*rsp_cap_pool;
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 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 */
goto out;
}
else if (srv != prev_srv) {
- s->be->counters.cum_lbconn++;
+ s->be->be_counters.cum_lbconn++;
srv->counters.cum_lbconn++;
}
set_target_server(&s->target, srv);
}
s->flags |= SN_REDISP;
prev_srv->counters.redispatches++;
- s->be->counters.redispatches++;
+ s->be->be_counters.redispatches++;
} else {
prev_srv->counters.retries++;
- s->be->counters.retries++;
+ s->be->be_counters.retries++;
}
}
}
}
srv->counters.failed_conns++;
- t->be->counters.failed_conns++;
+ t->be->be_counters.failed_conns++;
return 1;
case SRV_STATUS_NOSRV:
t->req->cons->err_loc = NULL;
}
- t->be->counters.failed_conns++;
+ t->be->be_counters.failed_conns++;
return 1;
case SRV_STATUS_QUEUED:
srv_inc_sess_ctr(srv);
if (srv)
srv->counters.failed_conns++;
- t->be->counters.failed_conns++;
+ t->be->be_counters.failed_conns++;
/* release other sessions waiting for this server */
if (may_dequeue_tasks(srv, t->be))
}
for (px = proxy; px; px = px->next) {
- if (clrall)
- memset(&px->counters, 0, sizeof(px->counters));
+ if (clrall) {
+ memset(&px->be_counters, 0, sizeof(px->be_counters));
+ memset(&px->fe_counters, 0, sizeof(px->fe_counters));
+ }
else {
- px->counters.feconn_max = 0;
- px->counters.beconn_max = 0;
- px->counters.fe_rps_max = 0;
- px->counters.fe_sps_max = 0;
- px->counters.fe_cps_max = 0;
- px->counters.be_sps_max = 0;
- px->counters.nbpend_max = 0;
+ px->be_counters.conn_max = 0;
+ px->be_counters.p.http.rps_max = 0;
+ px->be_counters.sps_max = 0;
+ px->be_counters.cps_max = 0;
+ px->be_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)
"",
read_freq_ctr(&px->fe_req_per_sec),
U2H0(read_freq_ctr(&px->fe_sess_per_sec)),
- px->counters.fe_rps_max,
- U2H1(px->counters.fe_sps_max),
+ px->fe_counters.p.http.rps_max,
+ U2H1(px->fe_counters.sps_max),
LIM2A2(px->fe_sps_lim, "-"));
} else {
chunk_printf(&msg,
"<td>%s</td><td>%s</td><td>%s</td>"
"",
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,
"<td>%s</td><td>%s</td><td>%s</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 */
if (px->mode == PR_MODE_HTTP) {
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++)
- 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,
"<td>%s</td><td>%s</td>"
"",
(px->mode == PR_MODE_HTTP)?"<u>":"",
- U2H6(px->counters.cum_fesess),
+ U2H6(px->fe_counters.cum_sess),
(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,
/* denied: req, resp */
/* rest of server: nothing */
"<td class=ac colspan=8></td></tr>"
"",
- U2H0(px->counters.denied_req), U2H1(px->counters.denied_resp),
- U2H2(px->counters.failed_req),
+ U2H0(px->fe_counters.denied_req), U2H1(px->fe_counters.denied_resp),
+ U2H2(px->fe_counters.failed_req),
px->state == PR_STRUN ? "OPEN" :
px->state == PR_STIDLE ? "FULL" : "STOP");
} else {
/* check_status, check_code, check_duration */
",,,",
px->id,
- px->feconn, px->counters.feconn_max, px->maxconn, px->counters.cum_fesess,
- px->counters.bytes_in, px->counters.bytes_out,
- px->counters.denied_req, px->counters.denied_resp,
- px->counters.failed_req,
+ px->feconn, px->fe_counters.conn_max, px->maxconn, px->fe_counters.cum_sess,
+ px->fe_counters.bytes_in, px->fe_counters.bytes_out,
+ px->fe_counters.denied_req, px->fe_counters.denied_resp,
+ px->fe_counters.failed_req,
px->state == PR_STRUN ? "OPEN" :
px->state == PR_STIDLE ? "FULL" : "STOP",
relative_pid, px->uuid, STATS_TYPE_FE,
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 */
if (px->mode == PR_MODE_HTTP) {
int 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 {
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);
+ px->fe_counters.p.http.rps_max, px->fe_counters.p.http.cum_req);
/* errors: cli_aborts, srv_aborts */
chunk_printf(&msg, ",,");
(uri->flags & ST_SHLGNDS)?"<u>":"",
px->id, px->id,
(uri->flags & ST_SHLGNDS)?"</u>":"",
- U2H0(px->nbpend) /* or px->totpend ? */, U2H1(px->counters.nbpend_max),
- U2H2(read_freq_ctr(&px->be_sess_per_sec)), U2H3(px->counters.be_sps_max));
+ U2H0(px->nbpend) /* or px->totpend ? */, U2H1(px->be_counters.nbpend_max),
+ U2H2(read_freq_ctr(&px->be_sess_per_sec)), U2H3(px->be_counters.sps_max));
chunk_printf(&msg,
/* sessions: current, max, limit */
"<td>%s</td><td>%s</td><td>%s</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 */
if (px->mode == PR_MODE_HTTP) {
chunk_printf(&msg, " title=\"rsp codes:");
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,
"<td>%s</td><td>%s</td>"
"",
(px->mode == PR_MODE_HTTP)?"<u>":"",
- U2H6(px->counters.cum_beconn),
+ U2H6(px->be_counters.cum_conn),
(px->mode == PR_MODE_HTTP)?"</u>":"",
- U2H7(px->counters.cum_lbconn),
- U2H8(px->counters.bytes_in), U2H9(px->counters.bytes_out));
+ U2H7(px->be_counters.cum_lbconn),
+ U2H8(px->be_counters.bytes_in), U2H9(px->be_counters.bytes_out));
chunk_printf(&msg,
/* denied: req, resp */
"<td class=ac>%s %s</td><td class=ac> </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),
- U2H2(px->counters.failed_conns),
- px->counters.cli_aborts,
- px->counters.srv_aborts,
- U2H5(px->counters.failed_resp),
- px->counters.retries, px->counters.redispatches,
+ U2H0(px->be_counters.denied_req), U2H1(px->be_counters.denied_resp),
+ U2H2(px->be_counters.failed_conns),
+ px->be_counters.cli_aborts,
+ px->be_counters.srv_aborts,
+ U2H5(px->be_counters.failed_resp),
+ px->be_counters.retries, px->be_counters.redispatches,
human_time(now.tv_sec - px->last_change, 1),
(px->lbprm.tot_weight > 0 || !px->srv) ? "UP" :
"<font color=\"red\"><b>DOWN</b></font>",
/* check_status, check_code, check_duration */
",,,",
px->id,
- px->nbpend /* or px->totpend ? */, px->counters.nbpend_max,
- px->beconn, px->counters.beconn_max, px->fullconn, px->counters.cum_beconn,
- px->counters.bytes_in, px->counters.bytes_out,
- px->counters.denied_req, px->counters.denied_resp,
- px->counters.failed_conns, px->counters.failed_resp,
- px->counters.retries, px->counters.redispatches,
+ px->nbpend /* or px->totpend ? */, px->be_counters.nbpend_max,
+ px->beconn, px->be_counters.conn_max, px->fullconn, px->be_counters.cum_conn,
+ px->be_counters.bytes_in, px->be_counters.bytes_out,
+ px->be_counters.denied_req, px->be_counters.denied_resp,
+ px->be_counters.failed_conns, px->be_counters.failed_resp,
+ px->be_counters.retries, px->be_counters.redispatches,
(px->lbprm.tot_weight > 0 || !px->srv) ? "UP" : "DOWN",
(px->lbprm.tot_weight * px->lbprm.wmult + px->lbprm.wdiv - 1) / px->lbprm.wdiv,
px->srv_act, px->srv_bck,
px->down_trans, (int)(now.tv_sec - px->last_change),
px->srv?be_downtime(px):0,
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),
- px->counters.be_sps_max);
+ px->be_counters.sps_max);
/* http response: 1xx, 2xx, 3xx, 4xx, 5xx, other */
if (px->mode == PR_MODE_HTTP) {
int 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 {
chunk_printf(&msg, ",,,,,,");
}
/* errors: cli_aborts, srv_aborts */
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 */
chunk_printf(&msg, "\n");
buffer_abort(s->rep);
req->analysers = 0;
- s->fe->counters.failed_req++;
+ s->fe->fe_counters.failed_req++;
if (s->listener->counters)
s->listener->counters->failed_req++;
/*
* 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
* modify it under the terms of the GNU General Public License
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.",
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) {
snprintf(trash, sizeof(trash),
"SIGHUP: Proxy %s %s ! Conn: act(FE+BE): %d+%d, %d pend (%d unass), tot(FE+BE): %lld+%lld.",
p->id,
(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 {
snprintf(trash, sizeof(trash),
"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.",
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);
send_log(p, LOG_NOTICE, "%s\n", trash);
session_inc_http_req_ctr(s);
proxy_inc_fe_req_ctr(s->fe);
- s->fe->counters.failed_req++;
+ s->fe->fe_counters.failed_req++;
if (s->listener->counters)
s->listener->counters->failed_req++;
session_inc_http_req_ctr(s);
proxy_inc_fe_req_ctr(s->fe);
- s->fe->counters.failed_req++;
+ s->fe->fe_counters.failed_req++;
if (s->listener->counters)
s->listener->counters->failed_req++;
session_inc_http_err_ctr(s);
session_inc_http_req_ctr(s);
proxy_inc_fe_req_ctr(s->fe);
- s->fe->counters.failed_req++;
+ s->fe->fe_counters.failed_req++;
if (s->listener->counters)
s->listener->counters->failed_req++;
txn->status = 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)
s->listener->counters->failed_req++;
txn->status = 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)
s->listener->counters->failed_req++;
req->analysers = 0;
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)
s->listener->counters->failed_req++;
req->analysers = 0;
req->analyse_exp = TICK_ETERNITY;
- s->fe->counters.failed_req++;
+ s->fe->fe_counters.failed_req++;
if (s->listener->counters)
s->listener->counters->failed_req++;
return_err_msg:
req->analysers = 0;
- s->fe->counters.failed_req++;
+ s->fe->fe_counters.failed_req++;
if (s->listener->counters)
s->listener->counters->failed_req++;
return 0;
n = 0;
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) &&
(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 */
}
else if (buf->flags & BF_SHUTW) {
txn->rsp.msg_state = HTTP_MSG_ERROR;
- s->be->counters.cli_aborts++;
+ s->be->be_counters.cli_aborts++;
if (target_srv(&s->target))
target_srv(&s->target)->counters.cli_aborts++;
goto wait_other_side;
s->flags |= SN_FINST_D;
}
- s->fe->counters.cli_aborts++;
- if (s->fe != s->be)
- s->be->counters.cli_aborts++;
+ s->fe->fe_counters.cli_aborts++;
+ s->be->be_counters.cli_aborts++;
if (target_srv(&s->target))
target_srv(&s->target)->counters.cli_aborts++;
return 0;
return_bad_req: /* let's centralize all bad requests */
- s->fe->counters.failed_req++;
+ s->fe->fe_counters.failed_req++;
if (s->listener->counters)
s->listener->counters->failed_req++;
return_bad_req_stats_ok:
req->analysers = 0;
s->rep->analysers = 0; /* we're in data phase, we want to abort both directions */
- s->fe->counters.srv_aborts++;
- if (s->fe != s->be)
- s->be->counters.srv_aborts++;
+ s->fe->fe_counters.srv_aborts++;
+ s->be->be_counters.srv_aborts++;
if (target_srv(&s->target))
target_srv(&s->target)->counters.srv_aborts++;
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);
- s->be->counters.failed_resp++;
+ s->be->be_counters.failed_resp++;
if (target_srv(&s->target)) {
target_srv(&s->target)->counters.failed_resp++;
health_adjust(target_srv(&s->target), HANA_STATUS_HTTP_HDRRSP);
if (msg->err_pos >= 0)
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)) {
target_srv(&s->target)->counters.failed_resp++;
health_adjust(target_srv(&s->target), HANA_STATUS_HTTP_READ_ERROR);
if (msg->err_pos >= 0)
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)) {
target_srv(&s->target)->counters.failed_resp++;
health_adjust(target_srv(&s->target), HANA_STATUS_HTTP_READ_TIMEOUT);
if (msg->err_pos >= 0)
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)) {
target_srv(&s->target)->counters.failed_resp++;
health_adjust(target_srv(&s->target), HANA_STATUS_HTTP_BROKEN_PIPE);
if (msg->err_pos >= 0)
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;
buffer_auto_close(rep);
target_srv(&t->target)->counters.failed_resp++;
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:
rep->analysers = 0;
txn->status = 502;
if (target_srv(&t->target))
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)
t->listener->counters->denied_resp++;
if (target_srv(&t->target))
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)
t->listener->counters->denied_resp++;
if (res->flags & BF_SHUTR) {
if (!(s->flags & SN_ERR_MASK))
s->flags |= SN_ERR_SRVCL;
- s->be->counters.srv_aborts++;
+ s->be->be_counters.srv_aborts++;
if (target_srv(&s->target))
target_srv(&s->target)->counters.srv_aborts++;
goto return_bad_res_stats_ok;
return 0;
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))
target_srv(&s->target)->counters.failed_resp++;
res->analysers = 0;
s->req->analysers = 0; /* we're in data phase, we want to abort both directions */
- s->fe->counters.cli_aborts++;
- if (s->fe != s->be)
- s->be->counters.cli_aborts++;
+ s->fe->fe_counters.cli_aborts++;
+ s->be->be_counters.cli_aborts++;
if (target_srv(&s->target))
target_srv(&s->target)->counters.cli_aborts++;
txn->flags |= TX_CLDENY;
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)
t->listener->counters->denied_req++;
txn->flags |= TX_CLTARPIT;
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)
t->listener->counters->denied_req++;
case ACT_DENY:
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)
t->listener->counters->denied_req++;
case ACT_TARPIT:
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)
t->listener->counters->denied_req++;
buffer_abort(s->rep);
req->analysers = 0;
- s->be->counters.denied_req++;
+ s->be->be_counters.denied_req++;
+ s->fe->fe_counters.denied_req++;
if (s->listener->counters)
s->listener->counters->denied_req++;
buffer_abort(s->req);
rep->analysers = 0;
- s->be->counters.denied_resp++;
+ s->be->be_counters.denied_resp++;
+ s->fe->fe_counters.denied_resp++;
if (s->listener->counters)
s->listener->counters->denied_resp++;
if (ret) {
/* we have a matching rule. */
if (rule->action == TCP_ACT_REJECT) {
- s->fe->counters.denied_conn++;
+ s->fe->fe_counters.denied_conn++;
if (s->listener->counters)
s->listener->counters->denied_conn++;
t = tick_remain(now_ms, p->stop_time);
if (t == 0) {
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",
- 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);
/* try to free more memory */
pool_gc2();
return 1;
s->be = be;
be->beconn++;
- if (be->beconn > be->counters.beconn_max)
- be->counters.beconn_max = be->beconn;
+ if (be->beconn > be->be_counters.conn_max)
+ be->be_counters.conn_max = be->beconn;
proxy_inc_be_ctr(be);
/* assign new parameters to the session from the new backend */
LIST_ADDQ(&sess->be->pendconns, &p->list);
sess->be->nbpend++;
sess->logs.prx_queue_size += sess->be->nbpend;
- if (sess->be->nbpend > sess->be->counters.nbpend_max)
- sess->be->counters.nbpend_max = sess->be->nbpend;
+ if (sess->be->nbpend > sess->be->be_counters.nbpend_max)
+ sess->be->be_counters.nbpend_max = sess->be->nbpend;
}
sess->be->totpend++;
return p;
}
/* This session was accepted, count it now */
- if (p->feconn > p->counters.feconn_max)
- p->counters.feconn_max = p->feconn;
+ if (p->feconn > p->fe_counters.conn_max)
+ p->fe_counters.conn_max = p->feconn;
proxy_inc_fe_sess_ctr(l, p);
if (s->stkctr1_entry) {
bytes = s->req->total - s->logs.bytes_in;
s->logs.bytes_in = s->req->total;
if (bytes) {
- s->fe->counters.bytes_in += bytes;
+ s->fe->fe_counters.bytes_in += bytes;
- if (s->be != s->fe)
- s->be->counters.bytes_in += bytes;
+ s->be->be_counters.bytes_in += bytes;
if (target_srv(&s->target))
target_srv(&s->target)->counters.bytes_in += bytes;
bytes = s->rep->total - s->logs.bytes_out;
s->logs.bytes_out = s->rep->total;
if (bytes) {
- s->fe->counters.bytes_out += bytes;
+ s->fe->fe_counters.bytes_out += bytes;
- if (s->be != s->fe)
- s->be->counters.bytes_out += bytes;
+ s->be->be_counters.bytes_out += bytes;
if (target_srv(&s->target))
target_srv(&s->target)->counters.bytes_out += bytes;
if (target_srv(&s->target))
target_srv(&s->target)->counters.failed_conns++;
- s->be->counters.failed_conns++;
+ s->be->be_counters.failed_conns++;
sess_change_server(s, NULL);
if (may_dequeue_tasks(target_srv(&s->target), s->be))
process_srv_queue(target_srv(&s->target));
} else {
if (target_srv(&s->target))
target_srv(&s->target)->counters.retries++;
- s->be->counters.retries++;
+ s->be->be_counters.retries++;
si->state = SI_ST_ASS;
}
srv_inc_sess_ctr(srv);
if (srv)
srv->counters.failed_conns++;
- s->be->counters.failed_conns++;
+ s->be->be_counters.failed_conns++;
/* release other sessions waiting for this server */
sess_change_server(s, NULL);
s->logs.t_queue = tv_ms_elapsed(&s->logs.tv_accept, &now);
if (srv)
srv->counters.failed_conns++;
- s->be->counters.failed_conns++;
+ s->be->be_counters.failed_conns++;
si->shutr(si);
si->shutw(si);
si->ob->flags |= BF_WRITE_TIMEOUT;
s->si[0].shutw(&s->si[0]);
stream_int_report_error(&s->si[0]);
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)
srv->counters.cli_aborts++;
if (!(s->flags & SN_ERR_MASK))
s->si[1].shutr(&s->si[1]);
s->si[1].shutw(&s->si[1]);
stream_int_report_error(&s->si[1]);
- s->be->counters.failed_resp++;
+ s->be->be_counters.failed_resp++;
if (srv)
srv->counters.failed_resp++;
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)
srv->counters.srv_aborts++;
if (!(s->flags & SN_ERR_MASK))
/* Report it if the client got an error or a read timeout expired */
s->req->analysers = 0;
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)
srv->counters.cli_aborts++;
s->flags |= SN_ERR_CLICL;
}
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)
srv->counters.cli_aborts++;
s->flags |= SN_ERR_CLITO;
}
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)
srv->counters.srv_aborts++;
s->flags |= SN_ERR_SRVCL;
}
else {
- s->be->counters.srv_aborts++;
+ s->be->be_counters.srv_aborts++;
+ s->fe->fe_counters.srv_aborts++;
if (srv)
srv->counters.srv_aborts++;
s->flags |= SN_ERR_SRVTO;
/* Report it if the server got an error or a read timeout expired */
s->rep->analysers = 0;
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)
srv->counters.srv_aborts++;
s->flags |= SN_ERR_SRVCL;
}
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)
srv->counters.srv_aborts++;
s->flags |= SN_ERR_SRVTO;
}
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)
srv->counters.cli_aborts++;
s->flags |= SN_ERR_CLICL;
}
else {
- s->be->counters.cli_aborts++;
+ s->be->be_counters.cli_aborts++;
+ s->fe->fe_counters.cli_aborts++;
if (srv)
srv->counters.cli_aborts++;
s->flags |= SN_ERR_CLITO;
n = 0;
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) &&
(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 */
if (!(s->flags & SN_FINST_MASK)) {
if (s->si[1].state < SI_ST_REQ) {
- s->fe->counters.failed_req++;
+ s->fe->fe_counters.failed_req++;
if (s->listener->counters)
s->listener->counters->failed_req++;