From: Willy Tarreau Date: Mon, 26 Nov 2012 13:13:09 +0000 (+0100) Subject: MINOR: stats: compute the ratio of compressed response based on 2xx responses X-Git-Tag: v1.5-dev15~45 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=5730c68b467945a83bcedded92f19b4dcda3d2bf;p=thirdparty%2Fhaproxy.git MINOR: stats: compute the ratio of compressed response based on 2xx responses 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. --- diff --git a/src/dumpstats.c b/src/dumpstats.c index 5df5eeb422..7cc5911aa8 100644 --- a/src/dumpstats.c +++ b/src/dumpstats.c @@ -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,