]> git.ipfire.org Git - thirdparty/haproxy.git/commitdiff
BUG/MINOR: peers: don't count track-sc multiple times on errors
authorWilly Tarreau <w@1wt.eu>
Tue, 26 Jul 2016 13:22:33 +0000 (15:22 +0200)
committerWilly Tarreau <w@1wt.eu>
Tue, 26 Jul 2016 13:25:32 +0000 (15:25 +0200)
Ruoshan Huang found that the call to session_inc_http_err_ctr() in the
recent http-response patch was not a good idea because it also increments
counters that are already tracked (eg: http-request track-sc or previous
http-response track-sc). Better open-code the update, it's simple.

src/proto_http.c

index d2090bbbcfe012c7b699c6703fa33393a7774fa9..3e18a6c84f1956b1646369ed843737ee049661c2 100644 (file)
@@ -3816,8 +3816,16 @@ resume_execution:
                                         * but here we're tracking after this ought to have been done so we have
                                         * to do it on purpose.
                                         */
-                                       if ((unsigned)(txn->status - 400) < 100)
-                                               stream_inc_http_err_ctr(s);
+                                       if ((unsigned)(txn->status - 400) < 100) {
+                                               ptr = stktable_data_ptr(t, ts, STKTABLE_DT_HTTP_ERR_CNT);
+                                               if (ptr)
+                                                       stktable_data_cast(ptr, http_err_cnt)++;
+
+                                               ptr = stktable_data_ptr(t, ts, STKTABLE_DT_HTTP_ERR_RATE);
+                                               if (ptr)
+                                                       update_freq_ctr_period(&stktable_data_cast(ptr, http_err_rate),
+                                                                              t->data_arg[STKTABLE_DT_HTTP_ERR_RATE].u, 1);
+                                       }
                                }
                        }
                        break;