You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@trafficserver.apache.org by cm...@apache.org on 2022/10/12 21:34:41 UTC

[trafficserver] branch master updated: Log trnx visited parent attempts (#9099)

This is an automated email from the ASF dual-hosted git repository.

cmcfarlen 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 e20e0bc78 Log trnx visited parent attempts (#9099)
e20e0bc78 is described below

commit e20e0bc78dcdad5025e5b7273dfd027ae4fd96e0
Author: Fabi Dias <11...@users.noreply.github.com>
AuthorDate: Wed Oct 12 15:34:34 2022 -0600

    Log trnx visited parent attempts (#9099)
    
    * add parent counter to transaction metrics in findParent and nextParent.
    
    * add to documentation
    
    Co-authored-by: Fabielle Dias <>
---
 doc/admin-guide/monitoring/statistics/core/http-connection.en.rst | 5 +++++
 proxy/http/HttpConfig.cc                                          | 4 ++++
 proxy/http/HttpConfig.h                                           | 2 +-
 proxy/http/HttpTransact.cc                                        | 2 ++
 4 files changed, 12 insertions(+), 1 deletion(-)

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 e00885c29..a2d95c4e0 100644
--- a/doc/admin-guide/monitoring/statistics/core/http-connection.en.rst
+++ b/doc/admin-guide/monitoring/statistics/core/http-connection.en.rst
@@ -159,6 +159,11 @@ HTTP Connection
 
    Counts the number of times a multi-hop proxy loop was detected
 
+.. ts:stat:: global proxy.process.http_parent_count integer
+   :type: counter
+
+   Counts the number of times current parent or next parent was detected
+
 HTTP/2
 ------
 
diff --git a/proxy/http/HttpConfig.cc b/proxy/http/HttpConfig.cc
index 5b97d15aa..68288a23b 100644
--- a/proxy/http/HttpConfig.cc
+++ b/proxy/http/HttpConfig.cc
@@ -1074,6 +1074,10 @@ register_stat_callbacks()
 
   RecRegisterRawStat(http_rsb, RECT_PROCESS, "proxy.process.http.dead_server.no_requests", RECD_COUNTER, RECP_PERSISTENT,
                      (int)http_dead_server_no_requests, RecRawStatSyncSum);
+
+  // Current transaction stats parent counter
+  RecRegisterRawStat(http_rsb, RECT_PROCESS, "proxy.process.http_parent_count", RECD_COUNTER, RECP_PERSISTENT,
+                     (int)http_parent_count, RecRawStatSyncCount);
 }
 
 static bool
diff --git a/proxy/http/HttpConfig.h b/proxy/http/HttpConfig.h
index 469b1c720..1b3090587 100644
--- a/proxy/http/HttpConfig.h
+++ b/proxy/http/HttpConfig.h
@@ -366,7 +366,7 @@ enum {
   http_origin_private,
   http_origin_close_private,
   http_origin_raw,
-
+  http_parent_count,
   http_stat_count
 };
 
diff --git a/proxy/http/HttpTransact.cc b/proxy/http/HttpTransact.cc
index d84dc4248..3a18c904a 100644
--- a/proxy/http/HttpTransact.cc
+++ b/proxy/http/HttpTransact.cc
@@ -187,6 +187,7 @@ inline static void
 findParent(HttpTransact::State *s)
 {
   url_mapping *mp = s->url_map.getMapping();
+  HTTP_INCREMENT_DYN_STAT(http_parent_count);
   if (s->response_action.handled) {
     s->parent_result.hostname = s->response_action.action.hostname;
     s->parent_result.port     = s->response_action.action.port;
@@ -277,6 +278,7 @@ nextParent(HttpTransact::State *s)
   TxnDebug("parent_down", "connection to parent %s failed, conn_state: %s, request to origin: %s", s->parent_result.hostname,
            HttpDebugNames::get_server_state_name(s->current.state), s->request_data.get_host());
   url_mapping *mp = s->url_map.getMapping();
+  HTTP_INCREMENT_DYN_STAT(http_parent_count);
   if (s->response_action.handled) {
     s->parent_result.hostname = s->response_action.action.hostname;
     s->parent_result.port     = s->response_action.action.port;