From: Casey Bodley Date: Fri, 28 Aug 2015 16:08:14 +0000 (-0400) Subject: blkin: set up tracing in the OSD X-Git-Tag: v12.0.3~73^2~22 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=a39b8c466e8fe22936b7195ab88b45da274f2a1e;p=ceph.git blkin: set up tracing in the OSD Signed-off-by: Casey Bodley --- diff --git a/src/common/TrackedOp.h b/src/common/TrackedOp.h index c5f6827ec831..5de461e9c63e 100644 --- a/src/common/TrackedOp.h +++ b/src/common/TrackedOp.h @@ -21,6 +21,7 @@ #include "include/utime.h" #include "common/Mutex.h" #include "common/histogram.h" +#include "common/zipkin_trace.h" #include "msg/Message.h" #include "include/memory.h" #include "common/RWLock.h" @@ -222,6 +223,8 @@ protected: virtual void _unregistered() {}; public: + ZTracer::Trace osd_trace; + virtual ~TrackedOp() {} void get() { diff --git a/src/osd/OSD.cc b/src/osd/OSD.cc index b4e837c241fd..6b41fbe7d4f1 100644 --- a/src/osd/OSD.cc +++ b/src/osd/OSD.cc @@ -1814,6 +1814,7 @@ OSD::OSD(CephContext *cct_, ObjectStore *store_, clog(log_client.create_channel()), whoami(id), dev_path(dev), journal_path(jdev), + trace_endpoint("0.0.0.0", 0, "osd"), asok_hook(NULL), osd_compat(get_osd_compat_set()), osd_tp(cct, "OSD::osd_tp", "tp_osd", cct->_conf->osd_op_threads, "osd_op_threads"), @@ -1879,6 +1880,11 @@ OSD::OSD(CephContext *cct_, ObjectStore *store_, cct->_conf->osd_op_history_duration); op_tracker.set_history_slow_op_size_and_threshold(cct->_conf->osd_op_history_slow_op_size, cct->_conf->osd_op_history_slow_op_threshold); +#ifdef WITH_BLKIN + std::stringstream ss; + ss << "osd." << whoami; + trace_endpoint.copy_name(ss.str()); +#endif } OSD::~OSD() @@ -6509,6 +6515,9 @@ void OSD::ms_fast_dispatch(Message *m) reqid.name._num, reqid.tid, reqid.inc); } + if (m->trace) + op->osd_trace.init("osd op", &trace_endpoint, &m->trace); + // note sender epoch, min req'd epoch op->sent_epoch = static_cast(m)->get_map_epoch(); op->min_epoch = static_cast(m)->get_min_epoch(); @@ -6744,6 +6753,8 @@ void OSD::_dispatch(Message *m) case MSG_OSD_RECOVERY_RESERVE: { OpRequestRef op = op_tracker.create_request(m); + if (m->trace) + op->osd_trace.init("osd op", &trace_endpoint, &m->trace); // no map? starting up? if (!osdmap) { dout(7) << "no OSDMap, not booted" << dendl; @@ -8914,6 +8925,9 @@ void OSD::enqueue_op(spg_t pg, OpRequestRef& op, epoch_t epoch) << " latency " << latency << " epoch " << epoch << " " << *(op->get_req()) << dendl; + op->osd_trace.event("enqueue op"); + op->osd_trace.keyval("priority", op->get_req()->get_priority()); + op->osd_trace.keyval("cost", op->get_req()->get_cost()); op->mark_queued_for_pg(); op_shardedwq.queue(make_pair(pg, PGQueueable(op, epoch))); } @@ -8950,6 +8964,7 @@ void OSD::dequeue_op( return; op->mark_reached_pg(); + op->osd_trace.event("dequeue_op"); pg->do_request(op, handle); diff --git a/src/osd/OSD.h b/src/osd/OSD.h index 833002312bfc..d63a1fb85aa5 100644 --- a/src/osd/OSD.h +++ b/src/osd/OSD.h @@ -25,6 +25,7 @@ #include "common/WorkQueue.h" #include "common/AsyncReserver.h" #include "common/ceph_context.h" +#include "common/zipkin_trace.h" #include "mgr/MgrClient.h" @@ -1321,6 +1322,7 @@ protected: int whoami; std::string dev_path, journal_path; + ZTracer::Endpoint trace_endpoint; void create_logger(); void create_recoverystate_perf(); void tick();