From 327b5bb229334c307341b53dc9cdcfd280d0c95f Mon Sep 17 00:00:00 2001 From: Pratik Mankawde <3397372+pratikmankawde@users.noreply.github.com> Date: Thu, 17 Sep 2026 13:44:53 +0100 Subject: [PATCH] fix(telemetry): keep the telemetry-off build clean A -DXRPL_ENABLE_TELEMETRY=0 build expands every XRPL_METRIC_* macro to nothing, so anything whose only use sits inside one looks unused. - MetricsRegistry::hasPipeline touches no member in that build, so clang-tidy asks for it to be static. Making it static would give the two builds different signatures, so suppress it the way Recording.h already does for the same reason. - PathRequest.cpp's only use of MetricMacros.h is such a macro, so mark the include as kept. - AppMetricGauges.cpp names MetricsRegistry and beast::Journal in a constructor signature that is compiled either way, so their includes move outside the telemetry guard. --- src/libxrpl/telemetry/MetricsRegistry.cpp | 5 +++++ src/xrpld/rpc/detail/PathRequest.cpp | 2 +- src/xrpld/telemetry/AppMetricGauges.cpp | 6 +++++- 3 files changed, 11 insertions(+), 2 deletions(-) diff --git a/src/libxrpl/telemetry/MetricsRegistry.cpp b/src/libxrpl/telemetry/MetricsRegistry.cpp index 177cedf8b0..43a75563f4 100644 --- a/src/libxrpl/telemetry/MetricsRegistry.cpp +++ b/src/libxrpl/telemetry/MetricsRegistry.cpp @@ -404,6 +404,10 @@ MetricsRegistry::stop() #endif // XRPL_ENABLE_TELEMETRY } +// This reads provider_ when telemetry is compiled in and touches no member +// when it is not, so clang-tidy asks for it to be static. Making it static +// would give the two builds different signatures. +// NOLINTBEGIN(readability-convert-member-functions-to-static) bool MetricsRegistry::hasPipeline() const noexcept { @@ -413,6 +417,7 @@ MetricsRegistry::hasPipeline() const noexcept return false; #endif } +// NOLINTEND(readability-convert-member-functions-to-static) // ----------------------------------------------------------------- // Synchronous instrument recording — RPC metrics diff --git a/src/xrpld/rpc/detail/PathRequest.cpp b/src/xrpld/rpc/detail/PathRequest.cpp index c891111978..888546ad0a 100644 --- a/src/xrpld/rpc/detail/PathRequest.cpp +++ b/src/xrpld/rpc/detail/PathRequest.cpp @@ -39,7 +39,7 @@ #include #include #include -#include +#include // IWYU pragma: keep #include #include #include diff --git a/src/xrpld/telemetry/AppMetricGauges.cpp b/src/xrpld/telemetry/AppMetricGauges.cpp index 655bb7195f..af0e7a1ce4 100644 --- a/src/xrpld/telemetry/AppMetricGauges.cpp +++ b/src/xrpld/telemetry/AppMetricGauges.cpp @@ -24,6 +24,11 @@ #include +// Both name types in the constructor signature, which is compiled in either +// way, so they belong outside the telemetry guard below. +#include +#include + #ifdef XRPL_ENABLE_TELEMETRY // The app and overlay includes below are why @@ -56,7 +61,6 @@ #include #include #include -#include #include #include #include