mgr: Include daemon details in SLOW_OPS output

Currently there is no way to see which daemons were involved in a slow
op after the op has cleared. This change allows us to record which
daemons were implicated in the logs.

Partially fixes: http://tracker.ceph.com/issues/23205

Signed-off-by: Brad Hubbard <bhubbard@redhat.com>
(cherry picked from commit b5263176de)
This commit is contained in:
Brad Hubbard 2018-05-01 11:15:28 +10:00 committed by Sage Weil
parent 4f98ff5e06
commit 303e71fe07

View File

@ -37,15 +37,20 @@ class SlowOps final : public DaemonHealthMetricCollector {
if (daemons.empty()) {
return;
}
static const char* fmt = "%1% slow ops, oldest one blocked for %2% sec";
check.summary = boost::str(boost::format(fmt) % value.n1 % value.n2);
static const char* fmt = "%1% slow ops, oldest one blocked for %2% sec, %3%";
ostringstream ss;
if (daemons.size() > 1) {
ss << "daemons " << daemons << " have slow ops.";
if (daemons.size() > 10) {
ss << "daemons " << vector<DaemonKey>(daemons.begin(), daemons.begin()+10)
<< "..." << " have slow ops.";
} else {
ss << "daemons " << daemons << " have slow ops.";
}
} else {
ss << daemons.front() << " has slow ops";
}
check.detail.push_back(ss.str());
check.summary = boost::str(boost::format(fmt) % value.n1 % value.n2 % ss.str());
// No detail
}
vector<DaemonKey> daemons;
};