From 5730c68b467945a83bcedded92f19b4dcda3d2bf Mon Sep 17 00:00:00 2001 From: Willy Tarreau Date: Mon, 26 Nov 2012 14:13:09 +0100 Subject: [PATCH] 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. --- src/dumpstats.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) 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, -- 2.39.5