From 1a3e8509b6b44c22387c7a7e5c3552050d088632 Mon Sep 17 00:00:00 2001 From: Brian Olsen Date: Fri, 16 Dec 2022 17:10:56 +0000 Subject: [PATCH 1/2] Add psrc and psuc log fields for parent simple/unavail retry counts. --- doc/admin-guide/logging/formatting.en.rst | 3 +++ proxy/logging/Log.cc | 10 +++++++++ proxy/logging/LogAccess.cc | 26 +++++++++++++++++++++++ proxy/logging/LogAccess.h | 26 ++++++++++++----------- 4 files changed, 53 insertions(+), 12 deletions(-) diff --git a/doc/admin-guide/logging/formatting.en.rst b/doc/admin-guide/logging/formatting.en.rst index d87fa62659d..7fd5054a63a 100644 --- a/doc/admin-guide/logging/formatting.en.rst +++ b/doc/admin-guide/logging/formatting.en.rst @@ -192,6 +192,7 @@ cccs Proxy Cache Cache collapsed connection success; Connections and Transactions ~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +.. _sta: .. _sca: .. _sstc: .. _ccid: @@ -205,6 +206,8 @@ transactions between |TS| proxies and origin servers. ===== ============== ================================================================== Field Source Description ===== ============== ================================================================== +purc Proxy Parent unavailable retry count within the current transaction by |TS| +psrc Proxy Parent simple server retry count within the current transaction by |TS| sca Proxy Number of attempts within the current transaction by |TS| in connecting to the origin server. sstc Proxy Number of transactions between the |TS| proxy and the origin diff --git a/proxy/logging/Log.cc b/proxy/logging/Log.cc index 4ab29e90402..a5183057ee5 100644 --- a/proxy/logging/Log.cc +++ b/proxy/logging/Log.cc @@ -831,6 +831,16 @@ Log::init_fields() global_field_list.add(field, false); field_symbol_hash.emplace("sstc", field); + field = new LogField("parent_unavailable_retry_count", "purc", LogField::sINT, &LogAccess::marshal_parent_unavailable_retry_count, + &LogAccess::unmarshal_int_to_str); + global_field_list.add(field, false); + field_symbol_hash.emplace("purc", field); + + field = new LogField("parent_simple_retry_count", "psrc", LogField::sINT, &LogAccess::marshal_parent_simple_retry_count, + &LogAccess::unmarshal_int_to_str); + global_field_list.add(field, false); + field_symbol_hash.emplace("psrc", field); + field = new LogField("server_connect_attempts", "sca", LogField::sINT, &LogAccess::marshal_server_connect_attempts, &LogAccess::unmarshal_int_to_str); global_field_list.add(field, false); diff --git a/proxy/logging/LogAccess.cc b/proxy/logging/LogAccess.cc index 56ff3cc4d6d..baba0f5cb1b 100644 --- a/proxy/logging/LogAccess.cc +++ b/proxy/logging/LogAccess.cc @@ -2626,6 +2626,32 @@ LogAccess::marshal_server_transact_count(char *buf) return INK_MIN_ALIGN; } +/*------------------------------------------------------------------------- + -------------------------------------------------------------------------*/ + +int +LogAccess::marshal_parent_simple_retry_count(char *buf) +{ + if (buf) { + const int64_t attempts = m_http_sm->t_state.current.simple_retry_attempts; + marshal_int(buf, attempts); + } + return INK_MIN_ALIGN; +} + +/*------------------------------------------------------------------------- + -------------------------------------------------------------------------*/ + +int +LogAccess::marshal_parent_unavailable_retry_count(char *buf) +{ + if (buf) { + const int64_t attempts = m_http_sm->t_state.current.unavailable_server_retry_attempts; + marshal_int(buf, attempts); + } + return INK_MIN_ALIGN; +} + /*------------------------------------------------------------------------- -------------------------------------------------------------------------*/ diff --git a/proxy/logging/LogAccess.h b/proxy/logging/LogAccess.h index c95ad18431f..1fc75b8e159 100644 --- a/proxy/logging/LogAccess.h +++ b/proxy/logging/LogAccess.h @@ -195,18 +195,20 @@ class LogAccess // // server -> proxy fields // - int marshal_server_host_ip(char *); // INT - int marshal_server_host_name(char *); // STR - int marshal_server_resp_status_code(char *); // INT - int marshal_server_resp_squid_len(char *); // INT - int marshal_server_resp_content_len(char *); // INT - int marshal_server_resp_header_len(char *); // INT - int marshal_server_resp_http_version(char *); // INT - int marshal_server_resp_time_ms(char *); // INT - int marshal_server_resp_time_s(char *); // INT - int marshal_server_transact_count(char *); // INT - int marshal_server_connect_attempts(char *); // INT - int marshal_server_resp_all_header_fields(char *); // STR + int marshal_server_host_ip(char *); // INT + int marshal_server_host_name(char *); // STR + int marshal_server_resp_status_code(char *); // INT + int marshal_server_resp_squid_len(char *); // INT + int marshal_server_resp_content_len(char *); // INT + int marshal_server_resp_header_len(char *); // INT + int marshal_server_resp_http_version(char *); // INT + int marshal_server_resp_time_ms(char *); // INT + int marshal_server_resp_time_s(char *); // INT + int marshal_server_transact_count(char *); // INT + int marshal_parent_simple_retry_count(char *); // INT + int marshal_parent_unavailable_retry_count(char *); // INT + int marshal_server_connect_attempts(char *); // INT + int marshal_server_resp_all_header_fields(char *); // STR // // cache -> client fields From 846b4b0b7726a537e0e1233f35e3a3df1cdfa2e9 Mon Sep 17 00:00:00 2001 From: Brian Olsen Date: Wed, 10 May 2023 17:02:49 +0000 Subject: [PATCH 2/2] rename from 'parent' to 'server --- doc/admin-guide/logging/formatting.en.rst | 7 ++++--- proxy/logging/Log.cc | 8 ++++---- proxy/logging/LogAccess.cc | 4 ++-- proxy/logging/LogAccess.h | 4 ++-- 4 files changed, 12 insertions(+), 11 deletions(-) diff --git a/doc/admin-guide/logging/formatting.en.rst b/doc/admin-guide/logging/formatting.en.rst index 7fd5054a63a..76a4dc10674 100644 --- a/doc/admin-guide/logging/formatting.en.rst +++ b/doc/admin-guide/logging/formatting.en.rst @@ -192,8 +192,9 @@ cccs Proxy Cache Cache collapsed connection success; Connections and Transactions ~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -.. _sta: .. _sca: +.. _surc: +.. _ssrc: .. _sstc: .. _ccid: .. _ctid: @@ -206,10 +207,10 @@ transactions between |TS| proxies and origin servers. ===== ============== ================================================================== Field Source Description ===== ============== ================================================================== -purc Proxy Parent unavailable retry count within the current transaction by |TS| -psrc Proxy Parent simple server retry count within the current transaction by |TS| sca Proxy Number of attempts within the current transaction by |TS| in connecting to the origin server. +surc Proxy Parent unavailable retry count within the current transaction by |TS|. +ssrc Proxy Parent simple server retry count within the current transaction by |TS|. sstc Proxy Number of transactions between the |TS| proxy and the origin server from a single session. Any value greater than zero indicates connection reuse. diff --git a/proxy/logging/Log.cc b/proxy/logging/Log.cc index a5183057ee5..266090ebf5e 100644 --- a/proxy/logging/Log.cc +++ b/proxy/logging/Log.cc @@ -831,15 +831,15 @@ Log::init_fields() global_field_list.add(field, false); field_symbol_hash.emplace("sstc", field); - field = new LogField("parent_unavailable_retry_count", "purc", LogField::sINT, &LogAccess::marshal_parent_unavailable_retry_count, + field = new LogField("server_unavailable_retry_count", "surc", LogField::sINT, &LogAccess::marshal_server_unavailable_retry_count, &LogAccess::unmarshal_int_to_str); global_field_list.add(field, false); - field_symbol_hash.emplace("purc", field); + field_symbol_hash.emplace("surc", field); - field = new LogField("parent_simple_retry_count", "psrc", LogField::sINT, &LogAccess::marshal_parent_simple_retry_count, + field = new LogField("server_simple_retry_count", "ssrc", LogField::sINT, &LogAccess::marshal_server_simple_retry_count, &LogAccess::unmarshal_int_to_str); global_field_list.add(field, false); - field_symbol_hash.emplace("psrc", field); + field_symbol_hash.emplace("ssrc", field); field = new LogField("server_connect_attempts", "sca", LogField::sINT, &LogAccess::marshal_server_connect_attempts, &LogAccess::unmarshal_int_to_str); diff --git a/proxy/logging/LogAccess.cc b/proxy/logging/LogAccess.cc index baba0f5cb1b..2909383c757 100644 --- a/proxy/logging/LogAccess.cc +++ b/proxy/logging/LogAccess.cc @@ -2630,7 +2630,7 @@ LogAccess::marshal_server_transact_count(char *buf) -------------------------------------------------------------------------*/ int -LogAccess::marshal_parent_simple_retry_count(char *buf) +LogAccess::marshal_server_simple_retry_count(char *buf) { if (buf) { const int64_t attempts = m_http_sm->t_state.current.simple_retry_attempts; @@ -2643,7 +2643,7 @@ LogAccess::marshal_parent_simple_retry_count(char *buf) -------------------------------------------------------------------------*/ int -LogAccess::marshal_parent_unavailable_retry_count(char *buf) +LogAccess::marshal_server_unavailable_retry_count(char *buf) { if (buf) { const int64_t attempts = m_http_sm->t_state.current.unavailable_server_retry_attempts; diff --git a/proxy/logging/LogAccess.h b/proxy/logging/LogAccess.h index 1fc75b8e159..08bfb8f3953 100644 --- a/proxy/logging/LogAccess.h +++ b/proxy/logging/LogAccess.h @@ -205,8 +205,8 @@ class LogAccess int marshal_server_resp_time_ms(char *); // INT int marshal_server_resp_time_s(char *); // INT int marshal_server_transact_count(char *); // INT - int marshal_parent_simple_retry_count(char *); // INT - int marshal_parent_unavailable_retry_count(char *); // INT + int marshal_server_simple_retry_count(char *); // INT + int marshal_server_unavailable_retry_count(char *); // INT int marshal_server_connect_attempts(char *); // INT int marshal_server_resp_all_header_fields(char *); // STR