Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions cmake/modules/BuildOpentelemetry.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -82,4 +82,5 @@ function(build_opentelemetry)
PROPERTIES
INTERFACE_LINK_LIBRARIES "${opentelemetry_deps}"
INTERFACE_INCLUDE_DIRECTORIES "${opentelemetry_include_dir}")
include_directories(SYSTEM "${opentelemetry_include_dir}")

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: since we have the opentelemetry::libopentelemetry target for this header dependency, we should probably require targets like ceph-common to depend on that target or jaeger_base instead of adding a global include_directories()

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

do you mean I should add the include dir and dependency separatly to each Cmake that needs that?
i.e. add:

if(WITH_JAEGER)
  add_dependencies(<target> opentelemetry::libopentelemetry)
  target_include_directories(<targte> PRIVATE 
    $<TARGET_PROPERTY:opentelemetry::libopentelemetry,INTERFACE_INCLUDE_DIRECTORIES>)
endif()

to: common, msg, auth, global, librados etc.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ideally we'd just add target_link_libraries(common PUBLIC opentelemetry::libopentelemetry) and other targets would inherit the dependency from that

but i recently went through a similar exercise trying to remove the global include_directories() for libfmt in #50479, and it was a huge mess because of all of the separate object libraries like auth, msg, etc that get linked into common

so let's leave this as-is, and think about cleaning up that mess of common dependencies later.. maybe.. some day

endfunction()
15 changes: 9 additions & 6 deletions src/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -299,6 +299,15 @@ if (WITH_BLKIN)
add_subdirectory(blkin/blkin-lib)
endif(WITH_BLKIN)

if(WITH_JAEGER)
find_package(thrift 0.13.0 REQUIRED)
include(BuildOpentelemetry)
build_opentelemetry()
add_library(jaeger_base INTERFACE)
target_link_libraries(jaeger_base INTERFACE opentelemetry::libopentelemetry
thrift::libthrift)
endif()

set(mds_files)
list(APPEND mds_files
mds/MDSMap.cc
Expand Down Expand Up @@ -432,12 +441,6 @@ target_compile_definitions(common-objs PRIVATE
add_dependencies(common-objs legacy-option-headers)

if(WITH_JAEGER)
find_package(thrift 0.13.0 REQUIRED)
include(BuildOpentelemetry)
build_opentelemetry()
add_library(jaeger_base INTERFACE)
target_link_libraries(jaeger_base INTERFACE opentelemetry::libopentelemetry
thrift::libthrift)
add_dependencies(common-objs jaeger_base)
target_link_libraries(common-objs jaeger_base)
endif()
Expand Down
37 changes: 1 addition & 36 deletions src/common/tracer.cc
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ jspan Tracer::start_trace(opentelemetry::nostd::string_view trace_name, bool tra
}

jspan Tracer::add_span(opentelemetry::nostd::string_view span_name, const jspan& parent_span) {
if (is_enabled() && parent_span->IsRecording()) {
if (is_enabled() && parent_span && parent_span->IsRecording()) {
opentelemetry::trace::StartSpanOptions span_opts;
span_opts.parent = parent_span->GetContext();
return tracer->StartSpan(span_name, span_opts);
Expand All @@ -73,41 +73,6 @@ bool Tracer::is_enabled() const {
return g_ceph_context->_conf->jaeger_tracing_enable;
}

void encode(const jspan_context& span_ctx, bufferlist& bl, uint64_t f) {
ENCODE_START(1, 1, bl);
using namespace opentelemetry;
using namespace trace;
auto is_valid = span_ctx.IsValid();
encode(is_valid, bl);
if (is_valid) {
encode_nohead(std::string_view(reinterpret_cast<const char*>(span_ctx.trace_id().Id().data()), TraceId::kSize), bl);
encode_nohead(std::string_view(reinterpret_cast<const char*>(span_ctx.span_id().Id().data()), SpanId::kSize), bl);
encode(span_ctx.trace_flags().flags(), bl);
}
ENCODE_FINISH(bl);
}

void decode(jspan_context& span_ctx, bufferlist::const_iterator& bl) {
using namespace opentelemetry;
using namespace trace;
DECODE_START(1, bl);
bool is_valid;
decode(is_valid, bl);
if (is_valid) {
std::array<uint8_t, TraceId::kSize> trace_id;
std::array<uint8_t, SpanId::kSize> span_id;
uint8_t flags;
decode(trace_id, bl);
decode(span_id, bl);
decode(flags, bl);
span_ctx = SpanContext(
TraceId(nostd::span<uint8_t, TraceId::kSize>(trace_id)),
SpanId(nostd::span<uint8_t, SpanId::kSize>(span_id)),
TraceFlags(flags),
true);
}
DECODE_FINISH(bl);
}
} // namespace tracing

#endif // HAVE_JAEGER
60 changes: 52 additions & 8 deletions src/common/tracer.h
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
#pragma once

#include "acconfig.h"
#include "include/buffer.h"
#include "include/encoding.h"

#ifdef HAVE_JAEGER
#include "opentelemetry/trace/provider.h"
Expand All @@ -18,10 +18,11 @@ namespace tracing {
class Tracer {
private:
const static opentelemetry::nostd::shared_ptr<opentelemetry::trace::Tracer> noop_tracer;
const static jspan noop_span;
opentelemetry::nostd::shared_ptr<opentelemetry::trace::Tracer> tracer;

public:
const static jspan noop_span;

Tracer() = default;
Tracer(opentelemetry::nostd::string_view service_name);

Expand All @@ -45,8 +46,41 @@ class Tracer {

};

void encode(const jspan_context& span, ceph::buffer::list& bl, uint64_t f = 0);
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);
using namespace opentelemetry;
using namespace trace;
auto is_valid = span_ctx.IsValid();
encode(is_valid, bl);
if (is_valid) {
encode_nohead(std::string_view(reinterpret_cast<const char*>(span_ctx.trace_id().Id().data()), TraceId::kSize), bl);
encode_nohead(std::string_view(reinterpret_cast<const char*>(span_ctx.span_id().Id().data()), SpanId::kSize), bl);
encode(span_ctx.trace_flags().flags(), bl);
}
ENCODE_FINISH(bl);
}

inline void decode(jspan_context& span_ctx, bufferlist::const_iterator& bl) {
using namespace opentelemetry;
using namespace trace;
DECODE_START(1, bl);
bool is_valid;
decode(is_valid, bl);
Comment thread
yuvalif marked this conversation as resolved.
Resolved
if (is_valid) {
std::array<uint8_t, TraceId::kSize> trace_id;
std::array<uint8_t, SpanId::kSize> span_id;
uint8_t flags;
decode(trace_id, bl);
decode(span_id, bl);
decode(flags, bl);
span_ctx = SpanContext(
TraceId(nostd::span<uint8_t, TraceId::kSize>(trace_id)),
SpanId(nostd::span<uint8_t, SpanId::kSize>(span_id)),
TraceFlags(flags),
true);
}
DECODE_FINISH(bl);
Comment thread
yuvalif marked this conversation as resolved.
Resolved
}

} // namespace tracing

Expand All @@ -62,10 +96,20 @@ class Value {

using jspan_attribute = Value;

struct jspan_context {
jspan_context() {}
jspan_context(bool sampled_flag, bool is_remote) {}
namespace opentelemetry {
inline namespace v1 {
namespace trace {
class SpanContext {
Comment thread
yuvalif marked this conversation as resolved.
Resolved
public:
SpanContext() = default;
SpanContext(bool sampled_flag, bool is_remote) {}
bool IsValid() const { return false;}
};
} // namespace trace
} // namespace v1
} // namespace opentelemetry

using jspan_context = opentelemetry::v1::trace::SpanContext;

struct span_stub {
jspan_context _ctx;
Expand All @@ -74,7 +118,7 @@ struct span_stub {
void AddEvent(std::string_view) {}
void AddEvent(std::string_view, std::initializer_list<std::pair<std::string_view, jspan_attribute>> fields) {}
template <typename T> void AddEvent(std::string_view name, const T& fields = {}) {}
const jspan_context& GetContext() { return _ctx; }
jspan_context GetContext() const { return _ctx; }
void UpdateName(std::string_view) {}
bool IsRecording() { return false; }
};
Expand Down
4 changes: 2 additions & 2 deletions src/include/rados/librados.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -1168,11 +1168,11 @@ inline namespace v14_2_0 {

// compound object operations
int operate(const std::string& oid, ObjectWriteOperation *op);
int operate(const std::string& oid, ObjectWriteOperation *op, int flags);
int operate(const std::string& oid, ObjectWriteOperation *op, int flags, const jspan_context *trace_info = nullptr);
int operate(const std::string& oid, ObjectReadOperation *op, bufferlist *pbl);
int operate(const std::string& oid, ObjectReadOperation *op, bufferlist *pbl, int flags);
int aio_operate(const std::string& oid, AioCompletion *c, ObjectWriteOperation *op);
int aio_operate(const std::string& oid, AioCompletion *c, ObjectWriteOperation *op, int flags);
int aio_operate(const std::string& oid, AioCompletion *c, ObjectWriteOperation *op, int flags, const jspan_context *trace_info = nullptr);
/**
* Schedule an async write operation with explicit snapshot parameters
*
Expand Down
12 changes: 12 additions & 0 deletions src/include/rados/librados_fwd.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,18 @@

struct blkin_trace_info;

namespace opentelemetry {
inline namespace v1 {
namespace trace {

class SpanContext;

} // namespace trace
} // inline namespace v1
} // namespace opentelemetry

using jspan_context = opentelemetry::v1::trace::SpanContext;

namespace libradosstriper {

class RadosStriper;
Expand Down
8 changes: 4 additions & 4 deletions src/librados/IoCtxImpl.cc
Original file line number Diff line number Diff line change
Expand Up @@ -637,7 +637,7 @@ int librados::IoCtxImpl::writesame(const object_t& oid, bufferlist& bl,
}

int librados::IoCtxImpl::operate(const object_t& oid, ::ObjectOperation *o,
ceph::real_time *pmtime, int flags)
ceph::real_time *pmtime, int flags, const jspan_context* otel_trace)
{
ceph::real_time ut = (pmtime ? *pmtime :
ceph::real_clock::now());
Expand All @@ -664,7 +664,7 @@ int librados::IoCtxImpl::operate(const object_t& oid, ::ObjectOperation *o,
oid, oloc,
*o, snapc, ut,
flags | extra_op_flags,
oncommit, &ver);
oncommit, &ver, osd_reqid_t(), nullptr, otel_trace);
objecter->op_submit(objecter_op);

{
Expand Down Expand Up @@ -752,7 +752,7 @@ int librados::IoCtxImpl::aio_operate_read(const object_t &oid,
int librados::IoCtxImpl::aio_operate(const object_t& oid,
::ObjectOperation *o, AioCompletionImpl *c,
const SnapContext& snap_context, int flags,
const blkin_trace_info *trace_info)
const blkin_trace_info *trace_info, const jspan_context *otel_trace)
Comment thread
ideepika marked this conversation as resolved.
Resolved
{
FUNCTRACE(client->cct);
OID_EVENT_TRACE(oid.name.c_str(), "RADOS_WRITE_OP_BEGIN");
Expand All @@ -778,7 +778,7 @@ int librados::IoCtxImpl::aio_operate(const object_t& oid,
trace.event("init root span");
Objecter::Op *op = objecter->prepare_mutate_op(
oid, oloc, *o, snap_context, ut, flags | extra_op_flags,
oncomplete, &c->objver, osd_reqid_t(), &trace);
oncomplete, &c->objver, osd_reqid_t(), &trace, otel_trace);
objecter->op_submit(op, &c->tid);
trace.event("rados operate op submitted");

Expand Down
4 changes: 2 additions & 2 deletions src/librados/IoCtxImpl.h
Original file line number Diff line number Diff line change
Expand Up @@ -154,11 +154,11 @@ struct librados::IoCtxImpl {
int getxattrs(const object_t& oid, std::map<std::string, bufferlist>& attrset);
int rmxattr(const object_t& oid, const char *name);

int operate(const object_t& oid, ::ObjectOperation *o, ceph::real_time *pmtime, int flags=0);
int operate(const object_t& oid, ::ObjectOperation *o, ceph::real_time *pmtime, int flags=0, const jspan_context *otel_trace = nullptr);
int operate_read(const object_t& oid, ::ObjectOperation *o, bufferlist *pbl, int flags=0);
int aio_operate(const object_t& oid, ::ObjectOperation *o,
AioCompletionImpl *c, const SnapContext& snap_context,
int flags, const blkin_trace_info *trace_info = nullptr);
int flags, const blkin_trace_info *trace_info = nullptr, const jspan_context *otel_trace = nullptr);
int aio_operate_read(const object_t& oid, ::ObjectOperation *o,
AioCompletionImpl *c, int flags, bufferlist *pbl, const blkin_trace_info *trace_info = nullptr);

Expand Down
6 changes: 3 additions & 3 deletions src/librados/librados_asio.h
Original file line number Diff line number Diff line change
Expand Up @@ -152,7 +152,7 @@ auto async_write(ExecutionContext& ctx, IoCtx& io, const std::string& oid,
template <typename ExecutionContext, typename CompletionToken>
auto async_operate(ExecutionContext& ctx, IoCtx& io, const std::string& oid,
ObjectReadOperation *read_op, int flags,
CompletionToken&& token)
CompletionToken&& token, const jspan_context* trace_ctx = nullptr)
{
using Op = detail::AsyncOp<bufferlist>;
using Signature = typename Op::Signature;
Expand All @@ -176,15 +176,15 @@ auto async_operate(ExecutionContext& ctx, IoCtx& io, const std::string& oid,
template <typename ExecutionContext, typename CompletionToken>
auto async_operate(ExecutionContext& ctx, IoCtx& io, const std::string& oid,
ObjectWriteOperation *write_op, int flags,
CompletionToken &&token)
CompletionToken &&token, const jspan_context* trace_ctx = nullptr)
{
using Op = detail::AsyncOp<void>;
using Signature = typename Op::Signature;
boost::asio::async_completion<CompletionToken, Signature> init(token);
auto p = Op::create(ctx.get_executor(), init.completion_handler);
auto& op = p->user_data;

int ret = io.aio_operate(oid, op.aio_completion.get(), write_op, flags);
int ret = io.aio_operate(oid, op.aio_completion.get(), write_op, flags, trace_ctx);
if (ret < 0) {
auto ec = boost::system::error_code{-ret, librados::detail::err_category()};
ceph::async::post(std::move(p), ec);
Expand Down
8 changes: 4 additions & 4 deletions src/librados/librados_cxx.cc
Original file line number Diff line number Diff line change
Expand Up @@ -1528,12 +1528,12 @@ int librados::IoCtx::operate(const std::string& oid, librados::ObjectWriteOperat
return io_ctx_impl->operate(obj, &o->impl->o, (ceph::real_time *)o->impl->prt);
}

int librados::IoCtx::operate(const std::string& oid, librados::ObjectWriteOperation *o, int flags)
int librados::IoCtx::operate(const std::string& oid, librados::ObjectWriteOperation *o, int flags, const jspan_context* otel_trace)
{
object_t obj(oid);
if (unlikely(!o->impl))
return -EINVAL;
return io_ctx_impl->operate(obj, &o->impl->o, (ceph::real_time *)o->impl->prt, translate_flags(flags));
return io_ctx_impl->operate(obj, &o->impl->o, (ceph::real_time *)o->impl->prt, translate_flags(flags), otel_trace);
}

int librados::IoCtx::operate(const std::string& oid, librados::ObjectReadOperation *o, bufferlist *pbl)
Expand Down Expand Up @@ -1562,14 +1562,14 @@ int librados::IoCtx::aio_operate(const std::string& oid, AioCompletion *c,
io_ctx_impl->snapc, 0);
}
int librados::IoCtx::aio_operate(const std::string& oid, AioCompletion *c,
ObjectWriteOperation *o, int flags)
ObjectWriteOperation *o, int flags, const jspan_context* otel_trace)
{
object_t obj(oid);
if (unlikely(!o->impl))
return -EINVAL;
return io_ctx_impl->aio_operate(obj, &o->impl->o, c->pc,
io_ctx_impl->snapc,
translate_flags(flags));
translate_flags(flags), nullptr, otel_trace);
}

int librados::IoCtx::aio_operate(const std::string& oid, AioCompletion *c,
Expand Down
16 changes: 13 additions & 3 deletions src/messages/MOSDOp.h
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ namespace _mosdop {
template<typename V>
class MOSDOp final : public MOSDFastDispatchOp {
private:
static constexpr int HEAD_VERSION = 8;
static constexpr int HEAD_VERSION = 9;

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@yuvalif @rzarzynski - This change seems to be causing failures in some fs suite runs where a new(-er) cephfs client talks to old cluster daemons. The client (ceph-fuse) is upgraded to reef (main branch) while the other ceph daemons are nautilus. Details are captured in this tracker: https://tracker.ceph.com/issues/59534

The upgraded client sends an osd_op with (version) v9. The OSD knows to decode upto v8 and would silently drop the request. This seems to be the case with pacific too: https://github.com/ceph/ceph/blob/pacific/src/messages/MOSDOp.h#L402

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

i don't see this change in reef. this is currently only on main. see HEAD_VERSION = 8 there https://github.com/ceph/ceph/blob/reef/src/messages/MOSDOp.h#L39

so, my suggestion is to wait for PR: #48971, and revert the version back to 8 - by repurposing the blkin trace entry to send otel traces

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

so, my suggestion is to wait for PR: #48971, and revert the version back to 8 - by repurposing the blkin trace entry to send otel traces

How soon would #48971 be merged? cephfs test runs are kind of blocked by this...

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

by repurposing the blkin trace entry to send otel traces

doesn't that still change the format of the encoding? i don't think we can reuse version 8 if the contents are different

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

there could be a workaround that by using some magic number to distinguish the 2 types of payloads, and decode and throw away if its not there.

on a different note, @vshankar, what happened in the past when we had to change the message format?

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is on ceph/main and not on ceph/reef, correct? This is a RADOS change, it's your call whether to revert first. Either way, let's find a coherent and testable change that can replace this. This feature has been in progress for a couple of years, if I'm not mistaken.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

reef isn't affected:

Let's revert to not hot-patch-in-a-hurry an encoding problem, then get into the weeds and arrange a meeting / workshop on the encoding stuff to finally merge the redo of this PR.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

+1

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No, that doesn't work. You need to guarantee compatibility of the messages at the protocol level, not via a config option that can be done wrong or that can have different values in different places. The RADOS team does this regularly and has a lot of models they should be able to share.

Given how broken the protocol changes here are, I really think we need to revert the whole PR until they can be hashed out properly — doing a quick fix is only going to come back and bite us. :( Not sure how you missed this @rzarzynski the first time around, but can you quickly provide some pointers?

I think I might have misunderstood the earlier conversation -- a feature bit would be a way to resolve this and might be the right one (I'm hoping we don't need to burn a bit that way, but if we need to we will). A config option would be very bad. :)

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Right - I was pointing out for using a feature bit and then choose the encoding versions accordingly.

Anyway, +1 for reverting which cannot be done via the github UI for this change. I guess @yuvalif is on it and the revert will be merged soon...

static constexpr int COMPAT_VERSION = 3;

private:
Expand Down Expand Up @@ -361,8 +361,7 @@ struct ceph_osd_request_head {
encode(retry_attempt, payload);
encode(features, payload);
} else {
// latest v8 encoding with hobject_t hash separate from pgid, no
// reassert version
// latest v9 opentelemetry trace

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

OK, here it is. Let's squash this fixup before merging.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@rzarzynski which commit do you want me to squash?

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The first one: a635a68.

Here is the exchange that spurred the fixup, I think.

header.version = HEAD_VERSION;

encode(pgid, payload);
Expand All @@ -371,6 +370,7 @@ struct ceph_osd_request_head {
encode(flags, payload);
encode(reqid, payload);
encode_trace(payload, features);
encode_otel_trace(payload, features);
Comment thread
ideepika marked this conversation as resolved.
Resolved

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There's the conversation about the encoding breaking things, and this here is the fundamental issue — you just shoved a new data member into the middle of an encoding, which is an absolutely incompatible change, and didn't do anything to make sure all the various endpoints involved were able to keep communicating.

I'm guessing this was modeled after 6159027, but that looks to have been riding along on an existing check for the SERVER_LUMINOUS flag to keep things okay (or else it was broken and fixed up elsewhere), which this PR doesn't get to take advantage of.

@yuvalif yuvalif Apr 29, 2023 •

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yes. will post a similar fix that checks on the SERVER_REEF flag.
however, in commit 6159027 the feature bit used in several files, but not in: MOSDOp.h . what is the reason for that? where should the fix be added?

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

created a fix here: #51288
if fix is acceptable, will squash into one commit


// -- above decoded up front; below decoded post-dispatch thread --

Expand Down Expand Up @@ -400,6 +400,16 @@ struct ceph_osd_request_head {

// Always keep here the newest version of decoding order/rule
if (header.version == HEAD_VERSION) {
decode(pgid, p);
uint32_t hash;
decode(hash, p);
hobj.set_hash(hash);
decode(osdmap_epoch, p);
decode(flags, p);
decode(reqid, p);
decode_trace(p);
decode_otel_trace(p);
} else if (header.version == 8) {
decode(pgid, p); // actual pgid
uint32_t hash;
decode(hash, p); // raw hash value
Expand Down
9 changes: 9 additions & 0 deletions src/msg/Message.cc
Original file line number Diff line number Diff line change
Expand Up @@ -1023,6 +1023,15 @@ void Message::decode_trace(ceph::bufferlist::const_iterator &p, bool create)
#endif
}

void Message::encode_otel_trace(ceph::bufferlist &bl, uint64_t features) const
{
tracing::encode(otel_trace, bl);
}

void Message::decode_otel_trace(ceph::bufferlist::const_iterator &p, bool create)
{
tracing::decode(otel_trace, p);

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

How costly this is in terms of performance?

CC: @markhpc.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

see: https://github.com/ceph/ceph/pull/47457/files#diff-b46d02199b4bb6f489ab7279d33d54db05f46245022bb937c48a94b36ba5d0cfR69
if no trace is sent, juts decodes a boolean.
if a trace is sent, it decodes tha span. the actual cost is denpendent with how much info is sent there.
however, if the user is turning tracing on, they expect cost in perfrmance.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍.

}

// This routine is not used for ordinary messages, but only when encapsulating a message
// for forwarding and routing. It's also used in a backward compatibility test, which only
Expand Down
Loading