]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
common/tracer: fix decoding when jaeger tracing is disabled 52114/head
authorLucian Petrut <lpetrut@cloudbasesolutions.com>
Wed, 12 Apr 2023 09:39:52 +0000 (09:39 +0000)
committerRadoslaw Zarzynski <rzarzyns@redhat.com>
Sat, 17 Feb 2024 19:31:06 +0000 (19:31 +0000)
We aren't currently using jaeger tracing on Windows. The issue is
that Windows hosts (or any other host that doesn't use jaeger)
are experiencing message decoding failures after a recent change [1].

This change updates the tracer encoding so that messages from
non-jaeger hosts may be decoded by services that use jaeger.

[1] https://github.com/ceph/ceph/pull/47457

Signed-off-by: Lucian Petrut <lpetrut@cloudbasesolutions.com>
This commit rebrings 3701ffa6733b001d4278a0b68395c5efe2382f25 which
got reverted due to an implicit dependency with other revert. Please
see https://github.com/ceph/ceph/pull/52114#issuecomment-1950288188.

Conflicts:
src/common/tracer.h
  formatting conflict with 7179ac0037320480f089e1a9e291cdc37282d250

src/common/tracer.h

index b039d304a79a8e45b66486945cdf315deabb3c51..ee0b744075454b8a6d594535f9781ed79ae45be6 100644 (file)
@@ -152,9 +152,20 @@ struct Tracer {
   jspan_ptr add_span(std::string_view span_name, const jspan_context& parent_ctx) { return {}; }
 };
 
-inline void encode(const jspan_context& span, bufferlist& bl, uint64_t f=0) {}
-inline void decode(jspan_context& span_ctx, ceph::buffer::list::const_iterator& bl) {}
+inline void encode(const jspan_context& span_ctx, bufferlist& bl, uint64_t f = 0) {
+  ENCODE_START(1, 1, bl);
+  // jaeger is missing, set "is_valid" to false.
+  bool is_valid = false;
+  encode(is_valid, bl);
+  ENCODE_FINISH(bl);
+}
 
+inline void decode(jspan_context& span_ctx, bufferlist::const_iterator& bl) {
+  DECODE_START(254, bl);
+  // jaeger is missing, consume the buffer but do not decode it.
+  DECODE_FINISH(bl);
 }
 
+} // namespace tracing
+
 #endif // !HAVE_JAEGER