mirror of
https://github.com/XRPLF/rippled.git
synced 2026-04-29 15:37:57 +00:00
Fix MetricsRegistry: add missing OpenLedger.h and Histogram::Record context arg
- Added missing #include <xrpld/app/ledger/OpenLedger.h> for
app.openLedger().current() calls in observable gauge callbacks.
- Added opentelemetry::context::Context{} as third argument to
Histogram::Record() calls — the initializer_list overload requires
an explicit Context parameter in the installed OTel C++ SDK version.
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -15,6 +15,7 @@
|
||||
|
||||
#include <xrpld/app/ledger/AcceptedLedger.h>
|
||||
#include <xrpld/app/ledger/LedgerMaster.h>
|
||||
#include <xrpld/app/ledger/OpenLedger.h>
|
||||
#include <xrpld/app/misc/TxQ.h>
|
||||
|
||||
#include <xrpl/basics/CountedObject.h>
|
||||
@@ -22,6 +23,7 @@
|
||||
#include <xrpl/nodestore/Database.h>
|
||||
#include <xrpl/server/LoadFeeTrack.h>
|
||||
|
||||
#include <opentelemetry/context/context.h>
|
||||
#include <opentelemetry/exporters/otlp/otlp_http_metric_exporter_factory.h>
|
||||
#include <opentelemetry/exporters/otlp/otlp_http_metric_exporter_options.h>
|
||||
#include <opentelemetry/metrics/provider.h>
|
||||
@@ -152,7 +154,9 @@ MetricsRegistry::recordRpcFinished(std::string_view method, std::int64_t duratio
|
||||
rpcFinishedCounter_->Add(1, {{"method", std::string(method)}});
|
||||
if (rpcDurationHistogram_)
|
||||
rpcDurationHistogram_->Record(
|
||||
static_cast<double>(durationUs), {{"method", std::string(method)}});
|
||||
static_cast<double>(durationUs),
|
||||
{{"method", std::string(method)}},
|
||||
opentelemetry::context::Context{});
|
||||
#else
|
||||
(void)method;
|
||||
(void)durationUs;
|
||||
@@ -168,7 +172,9 @@ MetricsRegistry::recordRpcErrored(std::string_view method, std::int64_t duration
|
||||
rpcErroredCounter_->Add(1, {{"method", std::string(method)}});
|
||||
if (rpcDurationHistogram_)
|
||||
rpcDurationHistogram_->Record(
|
||||
static_cast<double>(durationUs), {{"method", std::string(method)}});
|
||||
static_cast<double>(durationUs),
|
||||
{{"method", std::string(method)}},
|
||||
opentelemetry::context::Context{});
|
||||
#else
|
||||
(void)method;
|
||||
(void)durationUs;
|
||||
@@ -200,7 +206,9 @@ MetricsRegistry::recordJobStarted(std::string_view jobType, std::int64_t queuedD
|
||||
jobStartedCounter_->Add(1, {{"job_type", std::string(jobType)}});
|
||||
if (jobQueuedDurationHistogram_)
|
||||
jobQueuedDurationHistogram_->Record(
|
||||
static_cast<double>(queuedDurUs), {{"job_type", std::string(jobType)}});
|
||||
static_cast<double>(queuedDurUs),
|
||||
{{"job_type", std::string(jobType)}},
|
||||
opentelemetry::context::Context{});
|
||||
#else
|
||||
(void)jobType;
|
||||
(void)queuedDurUs;
|
||||
@@ -216,7 +224,9 @@ MetricsRegistry::recordJobFinished(std::string_view jobType, std::int64_t runnin
|
||||
jobFinishedCounter_->Add(1, {{"job_type", std::string(jobType)}});
|
||||
if (jobRunningDurationHistogram_)
|
||||
jobRunningDurationHistogram_->Record(
|
||||
static_cast<double>(runningDurUs), {{"job_type", std::string(jobType)}});
|
||||
static_cast<double>(runningDurUs),
|
||||
{{"job_type", std::string(jobType)}},
|
||||
opentelemetry::context::Context{});
|
||||
#else
|
||||
(void)jobType;
|
||||
(void)runningDurUs;
|
||||
|
||||
Reference in New Issue
Block a user