fix(telemetry): make this branch's files compile clean with telemetry off

The metric macros discard their arguments when telemetry is compiled out, so a
file's used-symbol set differs from the one its includes and declarations were
written for. That produced eleven clang-tidy errors here, all from that cause.

- guard <atomic>, <functional> and <memory> in MetricsRegistry.h, and
  <algorithm> and <optional> in DatabaseConfig_test.cpp, to match their uses
- include Journal.h directly in MetricsRegistry.cpp, whose constructor takes a
  beast::Journal by value in both configurations
- compile out recordGetObjectMetrics, its declaration, its call site and the
  two clock reads that feed it, since every statement in it records a metric
- drop two duplicate includes and rename a function-local static constant to
  kEmpty
This commit is contained in:
Pratik Mankawde
2026-08-26 18:07:39 +01:00
parent 879ad9fbe0
commit 7253aa787b
6 changed files with 47 additions and 17 deletions

View File

@@ -33,18 +33,23 @@
#include <xrpl/nodestore/detail/DatabaseRotatingImp.h>
#include <xrpl/rdb/DatabaseCon.h>
#include <algorithm>
#include <atomic>
#include <chrono>
#include <cstddef>
#include <cstdint>
#include <memory>
#include <optional>
#include <string>
#include <type_traits>
#include <utility>
#include <vector>
#ifdef XRPL_ENABLE_TELEMETRY
// std::ranges::sort / std::ranges::find_if and std::optional / std::nullopt are
// used only by the gauge-helper suite below, so they are guarded like its uses.
#include <algorithm>
#include <optional>
#endif
namespace xrpl::node_store {
class DatabaseConfig_test : public beast::unit_test::Suite