From: Willy Tarreau Date: Sat, 10 Sep 2011 21:29:44 +0000 (+0200) Subject: [MINOR] stats: report the number of requests intercepted by the frontend X-Git-Tag: v1.5-dev8~100 X-Git-Url: http://git.kaiwu.me/postgresql/log/contrib/postgres_fdw/postgres_fdw.c?a=commitdiff_plain;h=eabea0763ba6689338cfb1474c3228144fad3612;p=haproxy.git [MINOR] stats: report the number of requests intercepted by the frontend These requests are mainly monitor requests, as well as stats requests when the stats are processed by the frontend. Having this counter helps explain the difference in number of sessions that is sometimes observed between a frontend and a backend. --- diff --git a/include/types/counters.h b/include/types/counters.h index e3e051ff1..391915acd 100644 --- a/include/types/counters.h +++ b/include/types/counters.h @@ -48,6 +48,7 @@ struct pxcounters { 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) */ + long long intercepted_req; /* number of monitoring or stats requests intercepted by the frontend */ union { struct { diff --git a/src/dumpstats.c b/src/dumpstats.c index 814a90cad..d976e07ac 100644 --- a/src/dumpstats.c +++ b/src/dumpstats.c @@ -2286,7 +2286,8 @@ static int stats_dump_proxy(struct stream_interface *si, struct proxy *px, struc for (i = 1; i < 6; i++) chunk_printf(&msg, " %dxx=%lld,", i, px->fe_counters.p.http.rsp[i]); - chunk_printf(&msg, " other=%lld\"", px->fe_counters.p.http.rsp[0]); + chunk_printf(&msg, " other=%lld,", px->fe_counters.p.http.rsp[0]); + chunk_printf(&msg, " intercepted=%lld\"", px->fe_counters.intercepted_req); } chunk_printf(&msg, diff --git a/src/proto_http.c b/src/proto_http.c index 26b8f73ca..bf21ca9c8 100644 --- a/src/proto_http.c +++ b/src/proto_http.c @@ -2670,6 +2670,7 @@ int http_wait_for_request(struct session *s, struct buffer *req, int an_bit) struct acl_cond *cond; s->flags |= SN_MONITOR; + s->fe->fe_counters.intercepted_req++; /* Check if we want to fail this monitor request or not */ list_for_each_entry(cond, &s->fe->mon_fail_cond, list) { @@ -3275,6 +3276,8 @@ int http_process_req_common(struct session *s, struct buffer *req, int an_bit, s s->rep->prod->applet.private = s; s->rep->prod->applet.st0 = s->rep->prod->applet.st1 = 0; req->analysers = 0; + if (s->fe == s->be) /* report it if the request was intercepted by the frontend */ + s->fe->fe_counters.intercepted_req++; return 0;