diff --git a/src/libxrpl/telemetry/SpanGuard.cpp b/src/libxrpl/telemetry/SpanGuard.cpp index 361aa62ebf..38fbd04e5a 100644 --- a/src/libxrpl/telemetry/SpanGuard.cpp +++ b/src/libxrpl/telemetry/SpanGuard.cpp @@ -30,11 +30,13 @@ #include #include #include +#include #include #include #include #include #include +#include #include #include #include @@ -275,17 +277,19 @@ SpanGuard::hashSpan( if (hashSize < 16) return {}; auto* tel = Telemetry::getInstance(); - if (!tel || !tel->isEnabled() || !isCategoryEnabled(*tel, cat)) + if ((tel == nullptr) || !tel->isEnabled() || !isCategoryEnabled(*tel, cat)) return {}; - otel_trace::TraceId traceId(opentelemetry::nostd::span(hashData, 16)); + otel_trace::TraceId const traceId( + opentelemetry::nostd::span(hashData, 16)); - auto const rval = default_prng()(); + auto const rval = defaultPrng()(); std::uint8_t spanIdBytes[8]; std::memcpy(spanIdBytes, &rval, sizeof(spanIdBytes)); - otel_trace::SpanId spanId(opentelemetry::nostd::span(spanIdBytes, 8)); + otel_trace::SpanId const spanId( + opentelemetry::nostd::span(spanIdBytes, 8)); - otel_trace::SpanContext syntheticCtx( + otel_trace::SpanContext const syntheticCtx( traceId, spanId, otel_trace::TraceFlags(1), /* remote = */ false); auto parentCtx = opentelemetry::context::Context{}.SetValue( @@ -309,15 +313,16 @@ SpanGuard::hashSpan( if (hashSize < 16 || parentSpanSize != 8) return {}; auto* tel = Telemetry::getInstance(); - if (!tel || !tel->isEnabled() || !isCategoryEnabled(*tel, cat)) + if ((tel == nullptr) || !tel->isEnabled() || !isCategoryEnabled(*tel, cat)) return {}; - otel_trace::TraceId traceId(opentelemetry::nostd::span(hashData, 16)); + otel_trace::TraceId const traceId( + opentelemetry::nostd::span(hashData, 16)); - otel_trace::SpanId parentSpan( + otel_trace::SpanId const parentSpan( opentelemetry::nostd::span(parentSpanId, 8)); - otel_trace::SpanContext combinedCtx( + otel_trace::SpanContext const combinedCtx( traceId, parentSpan, otel_trace::TraceFlags(traceFlags), /* remote = */ true); auto parentCtx = opentelemetry::context::Context{}.SetValue(