Skip to content

logging: add a marshalled-bytes counter#13277

Merged
moonchen merged 2 commits into
apache:masterfrom
moonchen:log-marshalled-bytes-metric
Jun 19, 2026
Merged

logging: add a marshalled-bytes counter#13277
moonchen merged 2 commits 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
marshalled_bytes was incremented while computing bytes_needed, before
_checkout_write(); entries dropped because they exceed the buffer
payload (Log::FAIL) were still counted. Move the increment to after the
entry is checked out and marshalled into the buffer.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
@moonchen

Copy link
Copy Markdown
Contributor Author

[approve ci autest]

@moonchen moonchen merged commit 46346ba into apache:master Jun 19, 2026
15 checks passed
@github-project-automation github-project-automation Bot moved this to For v10.2.0 in ATS v10.2.x Jun 19, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

Status: For v10.2.0

Development

Successfully merging this pull request may close these issues.

4 participants