diff options
author | Omri Zeneva <ozeneva@redhat.com> | 2022-08-24 15:57:11 +0200 |
---|---|---|
committer | Yuval Lifshitz <ylifshit@redhat.com> | 2024-02-06 09:01:42 +0100 |
commit | 320a2179a3c6c1981a0fd2494938515997c1bfad (patch) | |
tree | 0c083b5c8ed3c467f99952346dda7abfad5a5f19 /src/librados | |
parent | Merge pull request #54311 from gabriel-samfira/do-not-escape-slash (diff) | |
download | ceph-320a2179a3c6c1981a0fd2494938515997c1bfad.tar.xz ceph-320a2179a3c6c1981a0fd2494938515997c1bfad.zip |
tracer/osd/librados/build/rgw: rgw and osd end2end tracing using opentelemetry
* build: add opentelemetry to cmake system
crimson targets that uses Message.cc/h are built before opentelemetry (o-tel), so we need to build o-tel eralier so we also add the library to the include path earlier
this shoud work for WITH_JAEGER flag both the ON/OFF cases, and for librados where the compilation flag is ignored
* msg/tracer: add o-tel trace to Messages with decode/encode function in tracer.h
some files that uses Message.cc/h just need the encode/decode functions and not all others functions.
some crimson targets does not link with ceph_context (common) which is required for tracer.cc file. so we just need to include that functions
* librados: Add opentelemtry trace param for aio_operate and operate methods
in order to propagate the trace info I added the otel-trace as an extra param.
in some places, there already was a blkin trace info, and since it is not used in other places we can safely change it to o-tel trace info.
this will be done in another commit, so the cleanup of blkin trace will be in a dedicated commit
* osd: use the o-tel trace of the msg as a parent span of the osd trace
if there is a valid span in the msg, we will add this op to the request
trace, otherwise it will start a new trace for the OSD op
* rgw: pass put obj trace info to librados
in order to make it possible, I saved the trace info inside the sal::Object, so we can use it later when writing the object to rados
it could be used also later for read ops.
note the trace field of req_state is initalized only in rgw_process, so it's also required in librgw request flow
* prevent breaking channges to kSize. make sure that changes between components built with
different versions of OTEL do not break message compatibility
Signed-off-by: Omri Zeneva <ozeneva@redhat.com>
Diffstat (limited to 'src/librados')
-rw-r--r-- | src/librados/IoCtxImpl.cc | 8 | ||||
-rw-r--r-- | src/librados/IoCtxImpl.h | 4 | ||||
-rw-r--r-- | src/librados/librados_asio.h | 6 | ||||
-rw-r--r-- | src/librados/librados_cxx.cc | 22 |
4 files changed, 30 insertions, 10 deletions
diff --git a/src/librados/IoCtxImpl.cc b/src/librados/IoCtxImpl.cc index d66b56560f9..b6be9050b1a 100644 --- a/src/librados/IoCtxImpl.cc +++ b/src/librados/IoCtxImpl.cc @@ -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()); @@ -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); { @@ -753,7 +753,7 @@ int librados::IoCtxImpl::aio_operate(const object_t& oid, ::ObjectOperation *o, AioCompletionImpl *c, const SnapContext& snap_context, const ceph::real_time *pmtime, int flags, - const blkin_trace_info *trace_info) + const blkin_trace_info *trace_info, const jspan_context *otel_trace) { FUNCTRACE(client->cct); OID_EVENT_TRACE(oid.name.c_str(), "RADOS_WRITE_OP_BEGIN"); @@ -779,7 +779,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"); diff --git a/src/librados/IoCtxImpl.h b/src/librados/IoCtxImpl.h index 477768ef78a..23c402d7b5d 100644 --- a/src/librados/IoCtxImpl.h +++ b/src/librados/IoCtxImpl.h @@ -154,12 +154,12 @@ 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, const ceph::real_time *pmtime, int flags, - const blkin_trace_info *trace_info = nullptr); + 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); diff --git a/src/librados/librados_asio.h b/src/librados/librados_asio.h index bd672d951f7..2eae1c268f6 100644 --- a/src/librados/librados_asio.h +++ b/src/librados/librados_asio.h @@ -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; @@ -176,7 +176,7 @@ 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; @@ -184,7 +184,7 @@ auto async_operate(ExecutionContext& ctx, IoCtx& io, const std::string& oid, 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); diff --git a/src/librados/librados_cxx.cc b/src/librados/librados_cxx.cc index 926ddf86dab..f9bc3b8fd04 100644 --- a/src/librados/librados_cxx.cc +++ b/src/librados/librados_cxx.cc @@ -1525,6 +1525,14 @@ 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, translate_flags(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), otel_trace); +} + int librados::IoCtx::operate(const std::string& oid, librados::ObjectReadOperation *o, bufferlist *pbl) { object_t obj(oid); @@ -1550,6 +1558,7 @@ int librados::IoCtx::aio_operate(const std::string& oid, AioCompletion *c, return io_ctx_impl->aio_operate(obj, &o->impl->o, c->pc, io_ctx_impl->snapc, o->impl->prt, 0); } + int librados::IoCtx::aio_operate(const std::string& oid, AioCompletion *c, ObjectWriteOperation *o, int flags) { @@ -1558,7 +1567,18 @@ int librados::IoCtx::aio_operate(const std::string& oid, AioCompletion *c, return -EINVAL; return io_ctx_impl->aio_operate(obj, &o->impl->o, c->pc, io_ctx_impl->snapc, o->impl->prt, - translate_flags(flags)); + translate_flags(flags), nullptr); +} + +int librados::IoCtx::aio_operate(const std::string& oid, AioCompletion *c, + 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, o->impl->prt, + translate_flags(flags), nullptr, otel_trace); } int librados::IoCtx::aio_operate(const std::string& oid, AioCompletion *c, |