diff --git a/include/xrpl/telemetry/DeterministicIdGenerator.h b/include/xrpl/telemetry/DeterministicIdGenerator.h index b0ec492e55..ba351d233e 100644 --- a/include/xrpl/telemetry/DeterministicIdGenerator.h +++ b/include/xrpl/telemetry/DeterministicIdGenerator.h @@ -3,6 +3,8 @@ #ifdef XRPL_ENABLE_TELEMETRY #include +#include +#include #include #include diff --git a/src/libxrpl/telemetry/DeterministicIdGenerator.cpp b/src/libxrpl/telemetry/DeterministicIdGenerator.cpp index 2a2c8c65ec..ff54307d1b 100644 --- a/src/libxrpl/telemetry/DeterministicIdGenerator.cpp +++ b/src/libxrpl/telemetry/DeterministicIdGenerator.cpp @@ -16,6 +16,7 @@ #include #include +#include #include #include #include @@ -32,14 +33,14 @@ namespace { * Trace_id pinned by PendingTraceId, consumed by GenerateTraceId(). File-local * and thread-local, so it is set and read on the same thread with no locking. */ -thread_local std::optional> tlsPendingTraceId; +thread_local std::optional> gTlsPendingTraceId; /** * True once GenerateTraceId() has consumed the pending id. ~PendingTraceId * asserts on it to catch a forced-root span that never reached the SDK root * branch. */ -thread_local bool tlsPendingConsumed = false; +thread_local bool gTlsPendingConsumed = false; } // namespace @@ -52,11 +53,11 @@ DeterministicIdGenerator::DeterministicIdGenerator() opentelemetry::trace::TraceId DeterministicIdGenerator::GenerateTraceId() noexcept { - if (tlsPendingTraceId) + if (gTlsPendingTraceId) { - auto const id = *tlsPendingTraceId; - tlsPendingTraceId.reset(); - tlsPendingConsumed = true; + auto const id = *gTlsPendingTraceId; + gTlsPendingTraceId.reset(); + gTlsPendingConsumed = true; return opentelemetry::trace::TraceId( opentelemetry::nostd::span(id.data(), 16)); } @@ -71,8 +72,8 @@ DeterministicIdGenerator::GenerateSpanId() noexcept PendingTraceId::PendingTraceId(std::array const& id) noexcept { - tlsPendingTraceId = id; - tlsPendingConsumed = false; + gTlsPendingTraceId = id; + gTlsPendingConsumed = false; } PendingTraceId::~PendingTraceId() noexcept @@ -81,10 +82,10 @@ PendingTraceId::~PendingTraceId() noexcept // via GenerateTraceId(). If not, the SDK took a different branch than the // caller forced — a bug — so fail loudly in debug/test builds. XRPL_ASSERT( - tlsPendingConsumed, + gTlsPendingConsumed, "xrpl::telemetry::PendingTraceId : deterministic trace_id was not consumed"); - tlsPendingTraceId.reset(); // never leak, even in release - tlsPendingConsumed = false; + gTlsPendingTraceId.reset(); // never leak, even in release + gTlsPendingConsumed = false; } } // namespace xrpl::telemetry diff --git a/src/xrpld/consensus/Consensus.h b/src/xrpld/consensus/Consensus.h index 86987d9bc0..4e890aca91 100644 --- a/src/xrpld/consensus/Consensus.h +++ b/src/xrpld/consensus/Consensus.h @@ -15,7 +15,6 @@ #include #include #include -#include #include #include