mgr: print daemon_health_metrics to debug log

Signed-off-by: Sage Weil <sage@redhat.com>
This commit is contained in:
Sage Weil 2018-04-30 15:54:46 -05:00
parent ce6422af97
commit adc480e3b3
2 changed files with 19 additions and 0 deletions

View 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;

View 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));
}