1111
1212#ifdef XRPL_ENABLE_TELEMETRY
1313
14+ #include < xrpl/proto/xrpl.pb.h>
15+
1416#include < opentelemetry/context/context.h>
1517#include < opentelemetry/trace/default_span.h>
1618#include < opentelemetry/trace/span_context.h>
1719#include < opentelemetry/trace/trace_flags.h>
1820#include < opentelemetry/trace/trace_id.h>
1921
20- #include < xrpl/proto/xrpl.pb.h>
21-
2222#include < cstdint>
2323
2424namespace xrpl {
@@ -35,16 +35,14 @@ extractFromProtobuf(protocol::TraceContext const& proto)
3535{
3636 namespace trace = opentelemetry::trace;
3737
38- if (!proto.has_trace_id () || proto.trace_id ().size () != 16 ||
39- !proto. has_span_id () || proto.span_id ().size () != 8 )
38+ if (!proto.has_trace_id () || proto.trace_id ().size () != 16 || !proto. has_span_id () ||
39+ proto.span_id ().size () != 8 )
4040 {
4141 return opentelemetry::context::Context{};
4242 }
4343
44- trace::TraceId traceId (
45- reinterpret_cast <std::uint8_t const *>(proto.trace_id ().data ()));
46- trace::SpanId spanId (
47- reinterpret_cast <std::uint8_t const *>(proto.span_id ().data ()));
44+ trace::TraceId traceId (reinterpret_cast <std::uint8_t const *>(proto.trace_id ().data ()));
45+ trace::SpanId spanId (reinterpret_cast <std::uint8_t const *>(proto.span_id ().data ()));
4846 trace::TraceFlags flags (
4947 proto.has_trace_flags () ? static_cast <std::uint8_t >(proto.trace_flags ())
5048 : trace::TraceFlags::kIsSampled );
@@ -53,8 +51,7 @@ extractFromProtobuf(protocol::TraceContext const& proto)
5351
5452 return opentelemetry::context::Context{}.SetValue (
5553 trace::kSpanKey ,
56- opentelemetry::nostd::shared_ptr<trace::Span>(
57- new trace::DefaultSpan (spanCtx)));
54+ opentelemetry::nostd::shared_ptr<trace::Span>(new trace::DefaultSpan (spanCtx)));
5855}
5956
6057/* * Inject the current span's trace context into a protobuf TraceContext.
@@ -63,9 +60,7 @@ extractFromProtobuf(protocol::TraceContext const& proto)
6360 @param proto The protobuf TraceContext to populate.
6461*/
6562inline void
66- injectToProtobuf (
67- opentelemetry::context::Context const & ctx,
68- protocol::TraceContext& proto)
63+ injectToProtobuf (opentelemetry::context::Context const & ctx, protocol::TraceContext& proto)
6964{
7065 namespace trace = opentelemetry::trace;
7166
0 commit comments