mirror of
https://github.com/XRPLF/rippled.git
synced 2026-06-03 00:36:48 +00:00
fix(telemetry): resolve Clang build, clang-tidy, and rename CI failures
- Add [[maybe_unused]] to RAII span variables in PathFind/RipplePathFind handlers (Clang -Wunused-variable with -Werror) - Restore over-renamed values: rippledb, rippled.cfg, historical GitHub URL - Concatenate nested namespaces in SpanNames.h and PathFindSpanNames.h (modernize-concat-nested-namespaces) - Add missing includes and const qualifiers in test files - Suppress intentional use-after-move in SpanGuardFactory move test - Remove unused NetworkOPs.h include from PathRequest.cpp Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -33,7 +33,7 @@ or may not hold a value. For things not guaranteed to exist,
|
||||
you use `x[~sfFoo]` because you want such a container. It
|
||||
avoids having to look something up twice, once just to see if
|
||||
it exists and a second time to get/set its value.
|
||||
([Real example](https://github.com/XRPLF/rippled/blob/35f4698aed5dce02f771b34cfbb690495cb5efcc/src/xrpld/app/tx/impl/PayChan.cpp#L229-L236))
|
||||
([Real example](https://github.com/XRPLF/rippled/blob/35f4698aed5dce02f771b34cfbb690495cb5efcc/src/ripple/app/tx/impl/PayChan.cpp#L229-L236))
|
||||
|
||||
The source of this "type magic" is in
|
||||
[SField.h](./SField.h#L296-L302).
|
||||
|
||||
@@ -24,8 +24,7 @@
|
||||
#include <cstddef>
|
||||
#include <string_view>
|
||||
|
||||
namespace xrpl {
|
||||
namespace telemetry {
|
||||
namespace xrpl::telemetry {
|
||||
|
||||
// ===== Compile-time string utility =========================================
|
||||
|
||||
@@ -117,5 +116,4 @@ inline constexpr auto error = makeStr("error");
|
||||
inline constexpr auto followsFrom = makeStr("follows_from");
|
||||
} // namespace attr_val
|
||||
|
||||
} // namespace telemetry
|
||||
} // namespace xrpl
|
||||
} // namespace xrpl::telemetry
|
||||
|
||||
@@ -2,6 +2,11 @@
|
||||
|
||||
#include <gtest/gtest.h>
|
||||
|
||||
#include <cstdint>
|
||||
#include <exception>
|
||||
#include <stdexcept>
|
||||
#include <utility>
|
||||
|
||||
using namespace xrpl;
|
||||
using namespace xrpl::telemetry;
|
||||
|
||||
@@ -52,7 +57,7 @@ TEST(SpanGuardFactory, move_construction_transfers_ownership)
|
||||
{
|
||||
auto span = SpanGuard::span(TraceCategory::Rpc, "rpc", "move");
|
||||
auto moved = std::move(span);
|
||||
EXPECT_FALSE(span);
|
||||
EXPECT_FALSE(span); // NOLINT(bugprone-use-after-move,hicpp-invalid-access-moved)
|
||||
moved.setAttribute("key", "value");
|
||||
}
|
||||
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
#include <xrpl/basics/BasicConfig.h>
|
||||
#include <xrpl/beast/utility/Journal.h>
|
||||
#include <xrpl/telemetry/Telemetry.h>
|
||||
|
||||
#include <gtest/gtest.h>
|
||||
@@ -9,7 +10,7 @@ using namespace xrpl;
|
||||
|
||||
TEST(TelemetryConfig, setup_defaults)
|
||||
{
|
||||
telemetry::Telemetry::Setup s;
|
||||
telemetry::Telemetry::Setup const s;
|
||||
EXPECT_FALSE(s.enabled);
|
||||
EXPECT_EQ(s.serviceName, "xrpld");
|
||||
EXPECT_TRUE(s.serviceVersion.empty());
|
||||
@@ -32,7 +33,7 @@ TEST(TelemetryConfig, setup_defaults)
|
||||
|
||||
TEST(TelemetryConfig, parse_empty_section)
|
||||
{
|
||||
Section section;
|
||||
Section const section;
|
||||
auto setup = telemetry::setup_Telemetry(section, "nHUtest123", "2.0.0", 0);
|
||||
|
||||
EXPECT_FALSE(setup.enabled);
|
||||
@@ -92,7 +93,7 @@ TEST(TelemetryConfig, null_telemetry_factory)
|
||||
setup.enabled = false;
|
||||
|
||||
beast::Journal::Sink& sink = beast::Journal::getNullSink();
|
||||
beast::Journal j(sink);
|
||||
beast::Journal const j(sink);
|
||||
auto tel = telemetry::make_Telemetry(setup, j);
|
||||
EXPECT_TRUE(tel != nullptr);
|
||||
EXPECT_FALSE(tel->isEnabled());
|
||||
|
||||
@@ -53,7 +53,7 @@ private:
|
||||
// name of state database
|
||||
std::string const dbName_ = "state";
|
||||
// prefix of on-disk nodestore backend instances
|
||||
std::string const dbPrefix_ = "xrpldb"; // cspell: disable-line
|
||||
std::string const dbPrefix_ = "rippledb"; // cspell: disable-line
|
||||
// check health/stop status as records are copied
|
||||
std::uint64_t const checkHealthInterval_ = 1000;
|
||||
// minimum # of ledgers to maintain for health of network
|
||||
|
||||
@@ -249,7 +249,7 @@ getSingleSection(
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
char const* const Config::configFileName = "xrpld.cfg";
|
||||
char const* const Config::configLegacyName = "xrpld.cfg";
|
||||
char const* const Config::configLegacyName = "rippled.cfg";
|
||||
char const* const Config::databaseDirName = "db";
|
||||
char const* const Config::validatorsFileName = "validators.txt";
|
||||
|
||||
|
||||
@@ -41,9 +41,7 @@
|
||||
|
||||
#include <xrpl/telemetry/SpanNames.h>
|
||||
|
||||
namespace xrpl {
|
||||
namespace telemetry {
|
||||
namespace pathfind_span {
|
||||
namespace xrpl::telemetry::pathfind_span {
|
||||
|
||||
// ===== Span prefixes =======================================================
|
||||
|
||||
@@ -85,6 +83,4 @@ inline constexpr auto numRequests = join(xrplPathfind, makeStr("num_requests"));
|
||||
inline constexpr auto ledgerIndex = join(xrplPathfind, makeStr("ledger_index"));
|
||||
} // namespace attr
|
||||
|
||||
} // namespace pathfind_span
|
||||
} // namespace telemetry
|
||||
} // namespace xrpl
|
||||
} // namespace xrpl::telemetry::pathfind_span
|
||||
|
||||
@@ -35,7 +35,6 @@
|
||||
#include <xrpl/resource/Consumer.h>
|
||||
#include <xrpl/server/InfoSub.h>
|
||||
#include <xrpl/server/LoadFeeTrack.h>
|
||||
#include <xrpl/server/NetworkOPs.h>
|
||||
#include <xrpl/telemetry/SpanGuard.h>
|
||||
#include <xrpl/tx/paths/RippleCalc.h>
|
||||
|
||||
|
||||
@@ -18,7 +18,7 @@ Json::Value
|
||||
doPathFind(RPC::JsonContext& context)
|
||||
{
|
||||
using namespace telemetry;
|
||||
auto span = SpanGuard::span(
|
||||
[[maybe_unused]] auto span = SpanGuard::span(
|
||||
TraceCategory::Rpc, pathfind_span::prefix::pathfind, pathfind_span::op::request);
|
||||
if (context.app.config().PATH_SEARCH_MAX == 0)
|
||||
return rpcError(rpcNOT_SUPPORTED);
|
||||
|
||||
@@ -26,7 +26,7 @@ Json::Value
|
||||
doRipplePathFind(RPC::JsonContext& context)
|
||||
{
|
||||
using namespace telemetry;
|
||||
auto span = SpanGuard::span(
|
||||
[[maybe_unused]] auto span = SpanGuard::span(
|
||||
TraceCategory::Rpc, pathfind_span::prefix::pathfind, pathfind_span::op::request);
|
||||
if (context.app.config().PATH_SEARCH_MAX == 0)
|
||||
return rpcError(rpcNOT_SUPPORTED);
|
||||
|
||||
Reference in New Issue
Block a user