mirror of
https://github.com/XRPLF/rippled.git
synced 2026-09-26 23:19:07 +00:00
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.
This commit is contained in:
@@ -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
|
||||
|
||||
@@ -39,7 +39,7 @@
|
||||
#include <xrpl/resource/Consumer.h>
|
||||
#include <xrpl/server/InfoSub.h>
|
||||
#include <xrpl/server/LoadFeeTrack.h>
|
||||
#include <xrpl/telemetry/MetricMacros.h>
|
||||
#include <xrpl/telemetry/MetricMacros.h> // IWYU pragma: keep
|
||||
#include <xrpl/telemetry/Redaction.h>
|
||||
#include <xrpl/telemetry/SpanGuard.h>
|
||||
#include <xrpl/tx/paths/RippleCalc.h>
|
||||
|
||||
@@ -24,6 +24,11 @@
|
||||
|
||||
#include <xrpld/telemetry/AppMetricGauges.h>
|
||||
|
||||
// Both name types in the constructor signature, which is compiled in either
|
||||
// way, so they belong outside the telemetry guard below.
|
||||
#include <xrpl/beast/utility/Journal.h>
|
||||
#include <xrpl/telemetry/MetricsRegistry.h>
|
||||
|
||||
#ifdef XRPL_ENABLE_TELEMETRY
|
||||
|
||||
// The app and overlay includes below are why
|
||||
@@ -56,7 +61,6 @@
|
||||
#include <xrpl/basics/CountedObject.h>
|
||||
#include <xrpl/basics/Log.h>
|
||||
#include <xrpl/basics/UptimeClock.h>
|
||||
#include <xrpl/beast/utility/Journal.h>
|
||||
#include <xrpl/core/ServiceRegistry.h>
|
||||
#include <xrpl/json/json_value.h>
|
||||
#include <xrpl/nodestore/Database.h>
|
||||
|
||||
Reference in New Issue
Block a user