]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
common/zipkin_trace: fix blkin_trace_info encoding
authorSage Weil <sage@redhat.com>
Fri, 7 Apr 2017 19:50:25 +0000 (15:50 -0400)
committerSage Weil <sage@redhat.com>
Fri, 5 May 2017 18:05:24 +0000 (14:05 -0400)
- encode the same regardless of whether it is compiled in (!)
- encode in endian- and struct alignment-safe way.

Signed-off-by: Sage Weil <sage@redhat.com>
src/common/zipkin_trace.h
src/msg/Message.cc

index 94716b4ad97a1a82d51828485df54aa494771188..6d3f02b43e255d5fb08a0561150a77c0739b307b 100644 (file)
 #else // !WITH_BLKIN
 
 // add stubs for noop Trace and Endpoint
-struct blkin_trace_info {};
+
+// match the "real" struct
+struct blkin_trace_info {
+    int64_t trace_id;
+    int64_t span_id;
+    int64_t parent_span_id;
+};
 
 namespace ZTracer
 {
@@ -66,4 +72,20 @@ class Trace {
 
 #endif // !WITH_BLKIN
 
+static inline void encode(const blkin_trace_info& b, bufferlist& bl)
+{
+  ::encode(b.trace_id, bl);
+  ::encode(b.span_id, bl);
+  ::encode(b.parent_span_id, bl);
+}
+
+static inline void decode(blkin_trace_info& b, bufferlist::iterator& p)
+{
+  ::decode(b.trace_id, p);
+  ::decode(b.span_id, p);
+  ::decode(b.parent_span_id, p);
+}
+
+
+
 #endif // COMMON_ZIPKIN_TRACE_H
index 62cbcdd33cb93f3fa60fcb1f9bac35432bef3517..5579e34825a04ded217ec9e0fce2c17eb4dfbc9c 100644 (file)
@@ -841,9 +841,6 @@ Message *decode_message(CephContext *cct, int crcflags,
   return m;
 }
 
-
-WRITE_RAW_ENCODER(blkin_trace_info)
-
 void Message::encode_trace(bufferlist &bl, uint64_t features) const
 {
   auto p = trace.get_info();