]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
blkin: set up tracing in the OSD
authorCasey Bodley <cbodley@redhat.com>
Fri, 28 Aug 2015 16:08:14 +0000 (12:08 -0400)
committerSage Weil <sage@redhat.com>
Fri, 5 May 2017 18:04:51 +0000 (14:04 -0400)
Signed-off-by: Casey Bodley <cbodley@redhat.com>
src/common/TrackedOp.h
src/osd/OSD.cc
src/osd/OSD.h

index c5f6827ec83174a17c9fbdd4b66328d74c9ce934..5de461e9c63edef01bfdb98db49ab53ce8e8c704 100644 (file)
@@ -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() {
index b4e837c241fd1ac85f993adb71bca32b94ff69af..6b41fbe7d4f12675758df1ae5d20d947eb4c9bf3 100644 (file)
@@ -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<MOSDFastDispatchOp*>(m)->get_map_epoch();
   op->min_epoch = static_cast<MOSDFastDispatchOp*>(m)->get_min_epoch();
@@ -6744,6 +6753,8 @@ void OSD::_dispatch(Message *m)
   case MSG_OSD_RECOVERY_RESERVE:
     {
       OpRequestRef op = op_tracker.create_request<OpRequest, Message*>(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);
 
index 833002312bfc2eb40c73a997102288b7c6dcdcad..d63a1fb85aa5306de5810014b8128f5e3b7f2418 100644 (file)
@@ -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();