diff --git a/include/xrpl/telemetry/SpanGuard.h b/include/xrpl/telemetry/SpanGuard.h index 691e6ce8dc..11afe36c92 100644 --- a/include/xrpl/telemetry/SpanGuard.h +++ b/include/xrpl/telemetry/SpanGuard.h @@ -9,23 +9,25 @@ Dependency diagram: - +-------------------------------------------+ - | SpanGuard | - +-------------------------------------------+ - | - impl_ : unique_ptr (pimpl) | - +-------------------------------------------+ - | + span(name) : SpanGuard [static] | - | + span(cat, prefix, name) [static] | - | + childSpan(name) : SpanGuard | - | + linkedSpan(name) : SpanGuard | - | + captureContext() : SpanContext | - | + setAttribute(key, value) | - | + setOk() / setError(desc) | - | + addEvent(name) | - | + recordException(e) | - | + discard() | - | + operator bool() | - +-------------------------------------------+ + +------------------------------------------------+ + | SpanGuard | + +------------------------------------------------+ + | - impl_ : unique_ptr (pimpl) | + +------------------------------------------------+ + | + span(name) : SpanGuard [static] | + | + span(cat, prefix, name) [static] | + | + childSpan(name) : SpanGuard | + | + linkedSpan(name) : SpanGuard | + | + txSpan(prefix, name, hash) [static] | + | + txSpan(prefix, name, hash, parent) [static] | + | + captureContext() : SpanContext | + | + setAttribute(key, value) | + | + setOk() / setError(desc) | + | + addEvent(name) | + | + recordException(e) | + | + discard() | + | + operator bool() | + +------------------------------------------------+ | hides (pimpl) +-------+-------+ | | diff --git a/src/libxrpl/telemetry/SpanGuard.cpp b/src/libxrpl/telemetry/SpanGuard.cpp index 9facee670f..71f157d2b2 100644 --- a/src/libxrpl/telemetry/SpanGuard.cpp +++ b/src/libxrpl/telemetry/SpanGuard.cpp @@ -258,9 +258,9 @@ SpanGuard::txSpan( otel_trace::TraceId traceId(opentelemetry::nostd::span(hashData, 16)); std::uint8_t spanIdBytes[8]; - std::random_device rd; + thread_local std::mt19937 prng{std::random_device{}()}; for (auto& b : spanIdBytes) - b = static_cast(rd()); + b = static_cast(prng()); otel_trace::SpanId spanId(opentelemetry::nostd::span(spanIdBytes, 8)); otel_trace::SpanContext syntheticCtx(