]> git.ipfire.org Git - thirdparty/haproxy.git/commitdiff
[MINOR] stats: report the number of requests intercepted by the frontend
authorWilly Tarreau <w@1wt.eu>
Sat, 10 Sep 2011 21:29:44 +0000 (23:29 +0200)
committerWilly Tarreau <w@1wt.eu>
Sat, 10 Sep 2011 21:32:41 +0000 (23:32 +0200)
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.

include/types/counters.h
src/dumpstats.c
src/proto_http.c

index e3e051ff1d0117ff2834f0eb047fd1084883f233..391915acd9b7e77fc4f36f469a23f64a14fdf59a 100644 (file)
@@ -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 {
index 814a90cad88f5d4276c65f1a68defb79c4555bfd..d976e07ac69e073c8a9c354696f30770bbf85659 100644 (file)
@@ -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,
index 26b8f73ca9a970778a27ee191b72c11a19bd4639..bf21ca9c830869d6a8a09e087248aeb92823f02e 100644 (file)
@@ -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;