]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
mgr: print daemon_health_metrics to debug log
authorSage Weil <sage@redhat.com>
Mon, 30 Apr 2018 20:54:46 +0000 (15:54 -0500)
committerSage Weil <sage@redhat.com>
Tue, 1 May 2018 18:54:28 +0000 (13:54 -0500)
Signed-off-by: Sage Weil <sage@redhat.com>
src/mgr/DaemonHealthMetric.h
src/mgr/DaemonServer.cc

index e67815d2fd967fabd611e7e1c06b4edca51e8195..4719fa188b975dcaf7828d48a0bafa9fbe35181d 100644 (file)
@@ -4,6 +4,7 @@
 #pragma once
 
 #include <cstdint>
+#include <ostream>
 #include "include/denc.h"
 
 enum class daemon_metric : uint8_t {
@@ -12,6 +13,15 @@ enum class daemon_metric : uint8_t {
   NONE,
 };
 
+static inline const char *daemon_metric_name(daemon_metric t) {
+  switch (t) {
+  case daemon_metric::SLOW_OPS: return "SLOW_OPS";
+  case daemon_metric::PENDING_CREATING_PGS: return "PENDING_CREATING_PGS";
+  case daemon_metric::NONE: return "NONE";
+  default: return "???";
+  }
+}
+
 union daemon_metric_t {
   struct {
     uint32_t n1;
@@ -54,6 +64,11 @@ public:
     denc(v.value.n, p);
     DENC_FINISH(p);
   }
+
+  friend ostream& operator<<(ostream& out, const DaemonHealthMetric& m) {
+    return out << daemon_metric_name(m.get_type()) << "("
+              << m.get_n() << "|(" << m.get_n1() << "," << m.get_n2() << "))";
+  }
 private:
   daemon_metric type = daemon_metric::NONE;
   daemon_metric_t value;
index ca09f360925186966528731ca94f697537a2597e..421c87d8a6f457a3fcaf504804635befe6375d5f 100644 (file)
@@ -561,6 +561,8 @@ bool DaemonServer::handle_report(MMgrReport *m)
     if (m->get_connection()->peer_is_osd() || m->get_connection()->peer_is_mon()) {
       // only OSD and MON send health_checks to me now
       daemon->daemon_health_metrics = std::move(m->daemon_health_metrics);
+      dout(10) << "daemon_health_metrics " << daemon->daemon_health_metrics
+              << dendl;
     }
   }
 
@@ -1838,6 +1840,8 @@ void DaemonServer::send_report()
               << static_cast<uint8_t>(metric.get_type()) << dendl;
             continue;
           }
+         dout(20) << " + " << daemon.second->key << " "
+                  << metric << dendl;
           tie(acc, std::ignore) = accumulated.emplace(metric.get_type(),
               std::move(collector));
         }