diff --git a/src/libxrpl/telemetry/SpanGuard.cpp b/src/libxrpl/telemetry/SpanGuard.cpp index a2cbfe5ec6..3d3f52ca29 100644 --- a/src/libxrpl/telemetry/SpanGuard.cpp +++ b/src/libxrpl/telemetry/SpanGuard.cpp @@ -20,6 +20,7 @@ #ifdef XRPL_ENABLE_TELEMETRY +#include #include #include #include @@ -38,7 +39,7 @@ #include #include -#include +#include #include #include @@ -248,10 +249,9 @@ SpanGuard::txSpan( otel_trace::TraceId traceId(opentelemetry::nostd::span(hashData, 16)); + auto const rval = default_prng()(); std::uint8_t spanIdBytes[8]; - thread_local std::mt19937 prng{std::random_device{}()}; - for (auto& b : spanIdBytes) - b = static_cast(prng()); + std::memcpy(spanIdBytes, &rval, sizeof(spanIdBytes)); otel_trace::SpanId spanId(opentelemetry::nostd::span(spanIdBytes, 8)); otel_trace::SpanContext syntheticCtx( diff --git a/src/xrpld/telemetry/TxTracing.h b/src/xrpld/telemetry/TxTracing.h index d99163ee53..9cb0f296a6 100644 --- a/src/xrpld/telemetry/TxTracing.h +++ b/src/xrpld/telemetry/TxTracing.h @@ -13,11 +13,8 @@ #include #include -#include - -#ifdef XRPL_ENABLE_TELEMETRY #include -#endif +#include namespace xrpl { namespace telemetry {