]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
mon: add MDS metric metadata to health detail 2343/head
authorJohn Spray <john.spray@redhat.com>
Mon, 1 Sep 2014 17:43:11 +0000 (18:43 +0100)
committerJohn Spray <john.spray@redhat.com>
Tue, 2 Sep 2014 13:06:25 +0000 (14:06 +0100)
This is a bit wonky because the mon health structure expects
a string, and we have a key-val structure, but it's better
to output this somehow than to have it rot as a purely internal
thing.

Signed-off-by: John Spray <john.spray@redhat.com>
src/mon/MDSMonitor.cc

index c066e4904af8d3c5d2433c6084142db18ce1fff3..870a9e63c654f1e2d26a0576e5e20302c6ae763e 100644 (file)
@@ -13,6 +13,7 @@
  */
 
 #include <sstream>
+#include <boost/utility.hpp>
 
 #include "MDSMonitor.h"
 #include "Monitor.h"
@@ -581,7 +582,27 @@ void MDSMonitor::get_health(list<pair<health_status_t, string> >& summary,
     health.decode(bl_i);
 
     for (std::list<MDSHealthMetric>::iterator j = health.metrics.begin(); j != health.metrics.end(); ++j) {
-      summary.push_back(std::make_pair(j->sev, j->message));
+      int const rank = i->second.rank;
+      std::ostringstream message;
+      message << "mds" << rank << ": " << j->message;
+      summary.push_back(std::make_pair(j->sev, message.str()));
+
+      // There is no way for us to clealy associate detail entries with summary entries (#7192), so
+      // we duplicate the summary message in the detail string and tag the metadata on.
+      std::ostringstream detail_message;
+      detail_message << message.str();
+      if (j->metadata.size()) {
+        detail_message << "(";
+        std::map<std::string, std::string>::iterator k = j->metadata.begin();
+        while (k != j->metadata.end()) {
+          detail_message << k->first << ": " << k->second;
+          if (boost::next(k) != j->metadata.end()) {
+            detail_message << ", ";
+          }
+        }
+        detail_message << ")";
+      }
+      detail->push_back(std::make_pair(j->sev, detail_message.str()));
     }
   }
 }