Skip to content

logging: add a marshalled-bytes counter#13277

Open
moonchen wants to merge 1 commit into
apache:masterfrom
moonchen:log-marshalled-bytes-metric
Open

logging: add a marshalled-bytes counter#13277
moonchen wants to merge 1 commit into
apache:masterfrom
moonchen:log-marshalled-bytes-metric

Conversation

@moonchen

Copy link
Copy Markdown
Contributor

Adds proxy.process.log.marshalled_bytes, a counter that helps with estimating the cost of logging on an ATS instance.

Adds proxy.process.log.marshalled_bytes, a counter that helps with
estimating the cost of logging on an ATS instance.
Copilot AI review requested due to automatic review settings June 15, 2026 20:43

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Adds a new process metric to quantify how many bytes ATS marshals for logging, helping operators estimate logging overhead.

Changes:

  • Register a new counter metric: proxy.process.log.marshalled_bytes.
  • Track marshalled byte volume during LogObject::log() for log-access entries.
  • Extend the logging stats block (LogsStatsBlock) with the new counter pointer.

Reviewed changes

Copilot reviewed 3 out of 3 changed files in this pull request and generated no comments.

File Description
src/proxy/logging/LogObject.cc Increments the new marshalled_bytes counter during log entry preparation.
src/proxy/logging/LogConfig.cc Registers the new proxy.process.log.marshalled_bytes counter with the Metrics system.
include/proxy/logging/LogConfig.h Adds marshalled_bytes to LogsStatsBlock so it can be referenced from logging code.
Comments suppressed due to low confidence (1)

src/proxy/logging/LogObject.cc:645

  • proxy.process.log.marshalled_bytes is incremented before _checkout_write() succeeds. If the log entry is later dropped because no buffer is available (e.g., entry exceeds buffer payload and the function returns Log::FAIL), this counter still increases even though nothing was actually marshalled into a log buffer. Move the increment to after the buffer checkout succeeds (and keep it gated on lad) so the counter reflects bytes for successfully-buffered log-access entries.
    Metrics::Counter::increment(log_rsb.marshalled_bytes, bytes_needed);
  } else if (!text_entry.empty()) {
    bytes_needed = INK_ALIGN_DEFAULT(text_entry.size() + 1); // must include null terminator.
  }

@moonchen moonchen self-assigned this Jun 15, 2026
@moonchen moonchen added this to the 10.2.0 milestone Jun 15, 2026
@cmcfarlen cmcfarlen modified the milestones: 10.2.0, 11.0.0 Jun 15, 2026
@cmcfarlen cmcfarlen requested a review from bneradt June 15, 2026 22:09
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

Status: No status

Development

Successfully merging this pull request may close these issues.

3 participants