This is an automated email from the ASF dual-hosted git repository.
moonchen 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 46346ba402 logging: add a marshalled-bytes counter (#13277)
46346ba402 is described below
commit 46346ba4020f15a1e8e2e92b43baa51bf6df0f31
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.
---
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 d891cf0b23..b9a44a6a2d 100644
--- a/include/proxy/logging/LogConfig.h
+++ b/include/proxy/logging/LogConfig.h
@@ -49,6 +49,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 0aa16221db..f2c07d8a23 100644
--- a/src/proxy/logging/LogConfig.cc
+++ b/src/proxy/logging/LogConfig.cc
@@ -497,6 +497,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 03e1316a17..566705e211 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());