Skip to content

Commit e145264

Browse files
petrutlucian94rzarzynski
authored andcommitted
common/tracer: fix decoding when jaeger tracing is disabled
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] ceph#47457 Signed-off-by: Lucian Petrut <[email protected]> This commit rebrings 3701ffa which got reverted due to an implicit dependency with other revert. Please see ceph#52114 (comment). Conflicts: src/common/tracer.h formatting conflict with 7179ac0
1 parent 320a217 commit e145264

File tree

1 file changed

+13
-2
lines changed

1 file changed

+13
-2
lines changed

src/common/tracer.h

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -152,9 +152,20 @@ struct Tracer {
152152
jspan_ptr add_span(std::string_view span_name, const jspan_context& parent_ctx) { return {}; }
153153
};
154154

155-
inline void encode(const jspan_context& span, bufferlist& bl, uint64_t f=0) {}
156-
inline void decode(jspan_context& span_ctx, ceph::buffer::list::const_iterator& bl) {}
155+
inline void encode(const jspan_context& span_ctx, bufferlist& bl, uint64_t f = 0) {
156+
ENCODE_START(1, 1, bl);
157+
// jaeger is missing, set "is_valid" to false.
158+
bool is_valid = false;
159+
encode(is_valid, bl);
160+
ENCODE_FINISH(bl);
161+
}
157162

163+
inline void decode(jspan_context& span_ctx, bufferlist::const_iterator& bl) {
164+
DECODE_START(254, bl);
165+
// jaeger is missing, consume the buffer but do not decode it.
166+
DECODE_FINISH(bl);
158167
}
159168

169+
} // namespace tracing
170+
160171
#endif // !HAVE_JAEGER

0 commit comments

Comments
 (0)