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

cmcfarlen pushed a commit to branch 10.2.x
in repository https://gitbox.apache.org/repos/asf/trafficserver.git

commit 197ecbdeb00618b48af8b85b710103e253fb53f6
Author: Mo Chen <[email protected]>
AuthorDate: Fri Jun 19 12:53:42 2026 -0500

    logging: add a marshalled-bytes counter (#13277)
    
    Adds proxy.process.log.marshalled_bytes, a counter that helps with 
estimating the cost of logging on an ATS instance.
    
    (cherry picked from commit 46346ba4020f15a1e8e2e92b43baa51bf6df0f31)
---
 include/proxy/logging/LogConfig.h | 1 +
 src/proxy/logging/LogConfig.cc    | 1 +
 src/proxy/logging/LogObject.cc    | 2 ++
 3 files changed, 4 insertions(+)

diff --git a/include/proxy/logging/LogConfig.h 
b/include/proxy/logging/LogConfig.h
index 47a83d7693..f707f83755 100644
--- a/include/proxy/logging/LogConfig.h
+++ b/include/proxy/logging/LogConfig.h
@@ -48,6 +48,7 @@ struct LogsStatsBlock {
   Metrics::Counter::AtomicType *event_log_access_aggr;
   Metrics::Counter::AtomicType *event_log_access_full;
   Metrics::Counter::AtomicType *event_log_access_fail;
+  Metrics::Counter::AtomicType *marshalled_bytes;
   Metrics::Counter::AtomicType *num_sent_to_network;
   Metrics::Counter::AtomicType *num_lost_before_sent_to_network;
   Metrics::Counter::AtomicType *num_received_from_network;
diff --git a/src/proxy/logging/LogConfig.cc b/src/proxy/logging/LogConfig.cc
index dfa20f7d51..85d696b7d8 100644
--- a/src/proxy/logging/LogConfig.cc
+++ b/src/proxy/logging/LogConfig.cc
@@ -483,6 +483,7 @@ LogConfig::register_stat_callbacks()
   log_rsb.event_log_access_aggr             = 
Metrics::Counter::createPtr("proxy.process.log.event_log_access_aggr");
   log_rsb.event_log_access_full             = 
Metrics::Counter::createPtr("proxy.process.log.event_log_access_full");
   log_rsb.event_log_access_fail             = 
Metrics::Counter::createPtr("proxy.process.log.event_log_access_fail");
+  log_rsb.marshalled_bytes                  = 
Metrics::Counter::createPtr("proxy.process.log.marshalled_bytes");
   log_rsb.num_sent_to_network               = 
Metrics::Counter::createPtr("proxy.process.log.num_sent_to_network");
   log_rsb.num_lost_before_sent_to_network   = 
Metrics::Counter::createPtr("proxy.process.log.num_lost_before_sent_to_network");
   log_rsb.num_received_from_network         = 
Metrics::Counter::createPtr("proxy.process.log.num_received_from_network");
diff --git a/src/proxy/logging/LogObject.cc b/src/proxy/logging/LogObject.cc
index 997e394025..6cbbc65536 100644
--- a/src/proxy/logging/LogObject.cc
+++ b/src/proxy/logging/LogObject.cc
@@ -677,6 +677,8 @@ LogObject::log(LogAccess *lad, std::string_view text_entry)
   } else if (lad) {
     bytes_used = m_format->m_field_list.marshal(lad, &(*buffer)[offset]);
     ink_assert(bytes_needed >= bytes_used);
+    // Count only entries that were successfully checked out and marshalled, 
not dropped ones.
+    Metrics::Counter::increment(log_rsb.marshalled_bytes, bytes_needed);
   } else if (!text_entry.empty()) {
     char *dst = &(*buffer)[offset];
     memcpy(dst, text_entry.data(), text_entry.size());

Reply via email to