]> git.ipfire.org Git - thirdparty/haproxy.git/commitdiff
BUG/MAJOR: stats: correctly check for a possible divide error when showing compressio...
authorWilly Tarreau <w@1wt.eu>
Mon, 26 Nov 2012 15:44:48 +0000 (16:44 +0100)
committerWilly Tarreau <w@1wt.eu>
Mon, 26 Nov 2012 15:44:48 +0000 (16:44 +0100)
Commit 5730c68b changed to display compression ratios based on 2xx
responses, but we should then check that there are such responses
instead of checking for requests. The risk is a divide error if there
are some requests but no 2xx yet (eg: redirect).

src/dumpstats.c

index 7cc5911aa8402a3cd64bbe55f9898d9e07c2bf14..f2849efcebf2efafd492ddd6582ff352676afa5c 100644 (file)
@@ -2477,7 +2477,7 @@ static int stats_dump_proxy(struct stream_interface *si, struct proxy *px, struc
                                        chunk_appendf(&trash, " other=%lld,", px->fe_counters.p.http.rsp[0]);
                                        chunk_appendf(&trash, " compressed=%lld (%d%%)",
                                                      px->fe_counters.p.http.comp_rsp,
-                                                     px->fe_counters.p.http.cum_req ?
+                                                     px->fe_counters.p.http.rsp[2] ?
                                                      (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);
                                }
@@ -3218,7 +3218,7 @@ static int stats_dump_proxy(struct stream_interface *si, struct proxy *px, struc
                                        chunk_appendf(&trash, " other=%lld ", px->be_counters.p.http.rsp[0]);
                                        chunk_appendf(&trash, " compressed=%lld (%d%%)\"",
                                                      px->be_counters.p.http.comp_rsp,
-                                                     px->be_counters.p.http.cum_req ?
+                                                     px->be_counters.p.http.rsp[2] ?
                                                      (int)(100*px->be_counters.p.http.comp_rsp/px->be_counters.p.http.rsp[2]) : 0);
                                }