});
map<daemon_metric, unique_ptr<DaemonHealthMetricCollector>> accumulated;
- for (auto sercive : {"osd", "mon"} ) {
- auto daemons = daemon_state.get_by_service(sercive);
- for (const auto& daemon : daemons) {
- Mutex::Locker l(daemon.second->lock);
- for (const auto& metric : daemon.second->daemon_health_metrics) {
+ for (auto service : {"osd", "mon"} ) {
+ auto daemons = daemon_state.get_by_service(service);
+ for (const auto& [key,state] : daemons) {
+ Mutex::Locker l{state->lock};
+ for (const auto& metric : state->daemon_health_metrics) {
auto acc = accumulated.find(metric.get_type());
if (acc == accumulated.end()) {
auto collector = DaemonHealthMetricCollector::create(metric.get_type());
if (!collector) {
- derr << __func__ << " " << daemon.first << "." << daemon.second
- << " sent me an unknown health metric: "
- << static_cast<uint8_t>(metric.get_type()) << dendl;
+ derr << __func__ << " " << key.first << "." << key.second
+ << " sent me an unknown health metric: "
+ << hex << static_cast<uint8_t>(metric.get_type()) << dendl;
continue;
}
- dout(20) << " + " << daemon.second->key << " "
+ dout(20) << " + " << state->key << " "
<< metric << dendl;
tie(acc, std::ignore) = accumulated.emplace(metric.get_type(),
std::move(collector));
}
- acc->second->update(daemon.first, metric);
+ acc->second->update(key, metric);
}
}
}