]> git.ipfire.org Git - thirdparty/haproxy.git/commitdiff
MINOR: stats: compute the ratio of compressed response based on 2xx responses
authorWilly Tarreau <w@1wt.eu>
Mon, 26 Nov 2012 13:13:09 +0000 (14:13 +0100)
committerWilly Tarreau <w@1wt.eu>
Mon, 26 Nov 2012 15:19:46 +0000 (16:19 +0100)
Since only responses with status 200 can be compressed, let's only count the
ratio of compressed responses on the basis of the 2xx responses and not all
of them. Note that responses 206 are still included in this count but it gives
a better figure, especially for places where authentication is used and 401 is
common.

src/dumpstats.c

index 5df5eeb422b745258494ca766fc5ac47cadc1ff4..7cc5911aa8402a3cd64bbe55f9898d9e07c2bf14 100644 (file)
@@ -2478,7 +2478,7 @@ static int stats_dump_proxy(struct stream_interface *si, struct proxy *px, struc
                                        chunk_appendf(&trash, " compressed=%lld (%d%%)",
                                                      px->fe_counters.p.http.comp_rsp,
                                                      px->fe_counters.p.http.cum_req ?
-                                                     (int)(100*px->fe_counters.p.http.comp_rsp/px->fe_counters.p.http.cum_req) : 0);
+                                                     (int)(100*px->fe_counters.p.http.comp_rsp/px->fe_counters.p.http.rsp[2]) : 0);
                                        chunk_appendf(&trash, " intercepted=%lld\"", px->fe_counters.intercepted_req);
                                }
 
@@ -3219,7 +3219,7 @@ static int stats_dump_proxy(struct stream_interface *si, struct proxy *px, struc
                                        chunk_appendf(&trash, " compressed=%lld (%d%%)\"",
                                                      px->be_counters.p.http.comp_rsp,
                                                      px->be_counters.p.http.cum_req ?
-                                                     (int)(100*px->be_counters.p.http.comp_rsp/px->be_counters.p.http.cum_req) : 0);
+                                                     (int)(100*px->be_counters.p.http.comp_rsp/px->be_counters.p.http.rsp[2]) : 0);
                                }
 
                                chunk_appendf(&trash,