This is an automated email from the ASF dual-hosted git repository. rrm pushed a commit to branch master in repository https://gitbox.apache.org/repos/asf/trafficserver.git
The following commit(s) were added to refs/heads/master by this push: new 39c3de5 Add metrics for loop detection. (#8772) 39c3de5 is described below commit 39c3de51a6514b6c092252cfb51f73c92af4ec7e Author: Chris McFarlen <ch...@mcfarlen.us> AuthorDate: Wed Mar 30 23:12:49 2022 -0500 Add metrics for loop detection. (#8772) Co-authored-by: Chris McFarlen <cmcfar...@apple.com> --- .../monitoring/statistics/core/http-connection.en.rst | 10 ++++++++++ proxy/http/HttpConfig.cc | 6 ++++++ proxy/http/HttpConfig.h | 2 ++ proxy/http/HttpTransact.cc | 2 ++ 4 files changed, 20 insertions(+) diff --git a/doc/admin-guide/monitoring/statistics/core/http-connection.en.rst b/doc/admin-guide/monitoring/statistics/core/http-connection.en.rst index 0baa9db..e00885c 100644 --- a/doc/admin-guide/monitoring/statistics/core/http-connection.en.rst +++ b/doc/admin-guide/monitoring/statistics/core/http-connection.en.rst @@ -149,6 +149,16 @@ HTTP Connection Tracks the number of client requests that did not have a request sent to the origin server because the origin server was marked dead. +.. ts:stat:: global proxy.process.http.http_proxy_loop_detected integer + :type: counter + + Counts the number of times a proxy loop was detected + +.. ts:stat:: global proxy.process.http.http_proxy_mh_loop_detected integer + :type: counter + + Counts the number of times a multi-hop proxy loop was detected + HTTP/2 ------ diff --git a/proxy/http/HttpConfig.cc b/proxy/http/HttpConfig.cc index c1d8c46..8f64efb 100644 --- a/proxy/http/HttpConfig.cc +++ b/proxy/http/HttpConfig.cc @@ -495,6 +495,12 @@ register_stat_callbacks() RecRegisterRawStat(http_rsb, RECT_PROCESS, "proxy.process.http.extension_method_requests", RECD_COUNTER, RECP_PERSISTENT, (int)http_extension_method_requests_stat, RecRawStatSyncCount); + RecRegisterRawStat(http_rsb, RECT_PROCESS, "proxy.process.http.http_proxy_loop_detected", RECD_COUNTER, RECP_PERSISTENT, + (int)http_proxy_loop_detected_stat, RecRawStatSyncCount); + + RecRegisterRawStat(http_rsb, RECT_PROCESS, "proxy.process.http.http_proxy_mh_loop_detected", RECD_COUNTER, RECP_PERSISTENT, + (int)http_proxy_mh_loop_detected_stat, RecRawStatSyncCount); + RecRegisterRawStat(http_rsb, RECT_PROCESS, "proxy.process.http.broken_server_connections", RECD_COUNTER, RECP_PERSISTENT, (int)http_broken_server_connections_stat, RecRawStatSyncCount); diff --git a/proxy/http/HttpConfig.h b/proxy/http/HttpConfig.h index 145fffe..dad1111 100644 --- a/proxy/http/HttpConfig.h +++ b/proxy/http/HttpConfig.h @@ -112,6 +112,8 @@ enum { http_purge_requests_stat, http_connect_requests_stat, http_extension_method_requests_stat, + http_proxy_loop_detected_stat, + http_proxy_mh_loop_detected_stat, http_completed_requests_stat, http_broken_server_connections_stat, diff --git a/proxy/http/HttpTransact.cc b/proxy/http/HttpTransact.cc index 7741897..0823898 100644 --- a/proxy/http/HttpTransact.cc +++ b/proxy/http/HttpTransact.cc @@ -6711,6 +6711,7 @@ HttpTransact::will_this_request_self_loop(State *s) break; } SET_VIA_STRING(VIA_ERROR_TYPE, VIA_ERROR_LOOP_DETECTED); + HTTP_INCREMENT_DYN_STAT(http_proxy_loop_detected_stat); build_error_response(s, HTTP_STATUS_BAD_REQUEST, "Cycle Detected", "request#cycle_detected"); return true; } @@ -6744,6 +6745,7 @@ HttpTransact::will_this_request_self_loop(State *s) if (count > max_proxy_cycles) { TxnDebug("http_transact", "count = %d > max_proxy_cycles = %d : detected loop", count, max_proxy_cycles); SET_VIA_STRING(VIA_ERROR_TYPE, VIA_ERROR_LOOP_DETECTED); + HTTP_INCREMENT_DYN_STAT(http_proxy_mh_loop_detected_stat); build_error_response(s, HTTP_STATUS_BAD_REQUEST, "Multi-Hop Cycle Detected", "request#cycle_detected"); return true; } else {