mirror of
https://github.com/XRPLF/rippled.git
synced 2026-09-26 23:19:07 +00:00
Addresses review findings on the native-metrics work. StatsDCollector::onTimer drained the send buffer inside the polling_ gate. That gate holds back hook handlers until the application's services are built, but sendBuffers() is socket I/O. StatsDEventImpl derives only from EventImpl, so it never enters metrics_ and posts straight to the buffer; its |ms timings piled up before onCollectionReady and were dropped after onCollectionStopping. The drain now runs every tick, and outside metricsLock_, so onCollectionStopping no longer waits on a UDP flush. TelemetryImpl's constructor left meterProvider_ set when initMetrics() threw. initMetrics publishes globally as its last step, so a throw left getMeter() callers holding a provider nothing else could reach. Reset it in the catch. ~ApplicationImp caught only std::exception around telemetry shutdown while the callees reach third-party SDK code, so a foreign exception would have terminated the process. Added a logging catch-all. ValidationTracker's hard trim evicted by unordered_map bucket order. It now evicts oldest-first, so the entry dropped under pressure is the one least likely to still reconcile. The GetMeter test restored the global meter provider only on the success path, and ASSERT_TRUE early-returns past it. Uses xrpl::ScopeExit instead. The hook debounce window is a named constant rather than a bare 500 in a comparison, and the metric export cadence becomes operator-configurable through metric_export_interval_ms and metric_export_timeout_ms. Both are range-checked: the SDK warns and silently substitutes its own 60s/30s defaults when the timeout is not below the interval, so an unchecked value would slow export rather than speed it up. Parsing uses a signed representation because lexical_cast<uint32_t> accepts a leading minus and wraps it. Naming corrections: CollectorManager documented exported_instance, which no OTel dashboard uses; node-health queried job_count where the exported name is jobq_job_count; network-traffic and overlay-traffic-detail referenced an undeclared DS_PROMETHEUS variable; the counter table omitted the _total suffix the Prometheus exporter appends; the plan docs and task list carried an xrpld_ prefix formatName never applies; and OTelCollector::New()'s contract promised its instanceId, serviceName and networkType arguments were read, contradicting the definition that marks them unused.