mirror of
https://github.com/XRPLF/rippled.git
synced 2026-10-01 01:08:03 +00:00
perf(telemetry): increment the copy-forward total only when it is read
copyForwardTotal_ is a second atomic increment beside copyForwardCount_ on the same event, kept only so a metric never goes backwards: rotate() zeroes the per-rotation tally for its log line, which leaves that counter unusable as a rate. Its only reader is MetricsRegistry.cpp:1153, through copyForwardTotal(). Guard the increment. During a rotation window every archive-served non-duplicate read pays for it, and with telemetry compiled out there is nothing to read it back. copyForwardCount_ is untouched: rotate() exchanges it for the "copied forward N archive-served reads" warning, which is real logging, not instrumentation. The virtual and the member stay declared unconditionally, so the nodestore interface has the same shape in every configuration.
This commit is contained in:
@@ -108,6 +108,10 @@ private:
|
||||
// counter unusable as a metric: a series that drops to 0 on every swap
|
||||
// cannot be rated. This one only ever increases, so rate() over it reads
|
||||
// correctly and the two uses do not fight over one variable.
|
||||
//
|
||||
// Incremented only when telemetry is compiled in, since the metrics registry
|
||||
// is its only reader; otherwise it stays 0 and the fetch path does one atomic
|
||||
// increment less per copy-forward.
|
||||
std::atomic<std::uint64_t> copyForwardTotal_{0};
|
||||
|
||||
std::shared_ptr<NodeObject>
|
||||
|
||||
Reference in New Issue
Block a user