fix(telemetry): update accountReserve call to two-arg signature

Fees::accountReserve gained a second accountCount parameter (merged from
develop). MetricsRegistry called the old one-arg form accountReserve(0),
which no longer compiles. Use accountReserve(0, 1) -- one account, zero
owned objects -- which returns the base reserve, matching the metric's
intent and the value the one-arg form previously returned.

Also normalize three pre-existing Doxygen blocks in this file to house
style (opener/continuation prefixes) so the check-doxygen-style hook passes.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This commit is contained in:
Pratik Mankawde
2026-07-20 15:57:08 +01:00
parent a894d0fca2
commit 7383d9cb98

View File

@@ -1,13 +1,14 @@
/** MetricsRegistry implementation — OpenTelemetry metric instruments for xrpld.
This file contains:
- Construction / destruction logic for the OTel MeterProvider pipeline.
- Synchronous instrument creation (counters, histograms) for RPC, job
queue, and NodeStore I/O metrics.
- Observable gauge callback registration for cache hit rates, TxQ state,
CountedObject instances, load factors, and NodeStore queue depth.
- No-op stubs when XRPL_ENABLE_TELEMETRY is not defined.
*/
/**
* MetricsRegistry implementation — OpenTelemetry metric instruments for xrpld.
*
* This file contains:
* - Construction / destruction logic for the OTel MeterProvider pipeline.
* - Synchronous instrument creation (counters, histograms) for RPC, job
* queue, and NodeStore I/O metrics.
* - Observable gauge callback registration for cache hit rates, TxQ state,
* CountedObject instances, load factors, and NodeStore queue depth.
* - No-op stubs when XRPL_ENABLE_TELEMETRY is not defined.
*/
// On Windows, OTel's spin_lock_mutex.h (transitively included from
// MetricsRegistry.h) defines _WINSOCKAPI_ and includes <windows.h>.
@@ -88,17 +89,18 @@ constexpr char kJobQueuedDurationUs[] = "job_queued_us";
constexpr char kJobRunningDurationUs[] = "job_running_us";
constexpr char kRpcMethodDurationUs[] = "rpc_method_us";
/** Register an explicit-bucket histogram view for a microsecond-valued
* instrument.
/**
* Register an explicit-bucket histogram view for a microsecond-valued
* instrument.
*
* The SDK's default histogram buckets top out at 10,000 (10 ms when the
* values are microseconds), so any duration above 10 ms saturates and
* every quantile reads as 10 ms. Job wait/run times and RPC latencies
* routinely exceed that, so we install boundaries spanning 100 µs to
* 60 s to capture the real distribution.
* The SDK's default histogram buckets top out at 10,000 (10 ms when the
* values are microseconds), so any duration above 10 ms saturates and
* every quantile reads as 10 ms. Job wait/run times and RPC latencies
* routinely exceed that, so we install boundaries spanning 100 µs to
* 60 s to capture the real distribution.
*
* @param views The registry to add the view to.
* @param name Instrument name to match (e.g. "job_running_us").
* @param views The registry to add the view to.
* @param name Instrument name to match (e.g. "job_running_us").
*/
void
addMicrosecondHistogramView(metric_sdk::ViewRegistry& views, std::string const& name)
@@ -1200,8 +1202,10 @@ MetricsRegistry::registerLedgerEconomyGauge()
if (ledger)
{
auto const& fees = ledger->fees();
// Base reserve = one account, zero owned objects:
// accountReserve(ownerCount=0, accountCount=1) == reserve.
observe(
"reserve_base_xrp", static_cast<double>(fees.accountReserve(0).drops()));
"reserve_base_xrp", static_cast<double>(fees.accountReserve(0, 1).drops()));
observe("reserve_inc_xrp", static_cast<double>(fees.increment.drops()));
}