]> git.ipfire.org Git - thirdparty/pdns.git/commitdiff
chore: keep SpanID and TraceID together in the file
authorPieter Lexis <pieter.lexis@powerdns.com>
Thu, 25 Sep 2025 15:48:14 +0000 (17:48 +0200)
committerPieter Lexis <pieter.lexis@powerdns.com>
Tue, 14 Oct 2025 18:34:58 +0000 (20:34 +0200)
pdns/protozero-trace.hh

index 3ba88ccf042d157475f5d83ad1a0e692c1ce1c13..402d2803fd0968f9768012f7f00d1462680d1794 100644 (file)
@@ -236,6 +236,15 @@ struct TraceID : public std::array<uint8_t, 16>
     return ostrm << val.toLogString();
   }
 };
+constexpr TraceID s_emptyTraceID = {};
+inline void random(TraceID& trace)
+{
+  dns_random(trace.data(), trace.size());
+}
+inline void clear(TraceID& trace)
+{
+  trace.fill(0);
+}
 
 struct SpanID : public std::array<uint8_t, 8>
 {
@@ -245,19 +254,15 @@ struct SpanID : public std::array<uint8_t, 8>
     return ostrm << val.toLogString();
   }
 };
-
-constexpr TraceID s_emptyTraceID = {};
-
-inline void random(TraceID& trace)
-{
-  dns_random(trace.data(), trace.size());
-}
-
+constexpr SpanID s_emptySpanID = {};
 inline void random(SpanID& span)
 {
   dns_random(span.data(), span.size());
 }
-
+inline void clear(SpanID& span)
+{
+  span.fill(0);
+}
 inline SpanID randomSpanID()
 {
   SpanID ret;
@@ -265,16 +270,6 @@ inline SpanID randomSpanID()
   return ret;
 }
 
-inline void clear(TraceID& trace)
-{
-  trace.fill(0);
-}
-
-inline void clear(SpanID& span)
-{
-  span.fill(0);
-}
-
 inline void fill(TraceID& trace, const std::string& data)
 {
   if (data.size() != trace.size()) {