mirror of
https://github.com/ceph/ceph
synced 2025-01-01 16:42:29 +00:00
Merge pull request #17605 from jcsp/wip-21253
mgr: fix py calls for dne service perf counters Reviewed-by: Sage Weil <sage@redhat.com>
This commit is contained in:
commit
d35991bd0f
@ -85,7 +85,12 @@ DaemonStatePtr DaemonStateIndex::get(const DaemonKey &key)
|
||||
{
|
||||
Mutex::Locker l(lock);
|
||||
|
||||
return all.at(key);
|
||||
auto iter = all.find(key);
|
||||
if (iter != all.end()) {
|
||||
return iter->second;
|
||||
} else {
|
||||
return nullptr;
|
||||
}
|
||||
}
|
||||
|
||||
void DaemonStateIndex::cull(const std::string& svc_name,
|
||||
|
@ -694,9 +694,8 @@ PyObject* PyModules::get_counter_python(
|
||||
f.open_array_section(path.c_str());
|
||||
|
||||
auto metadata = daemon_state.get(DaemonKey(svc_name, svc_id));
|
||||
|
||||
Mutex::Locker l2(metadata->lock);
|
||||
if (metadata) {
|
||||
Mutex::Locker l2(metadata->lock);
|
||||
if (metadata->perf_counters.instances.count(path)) {
|
||||
auto counter_instance = metadata->perf_counters.instances.at(path);
|
||||
const auto &data = counter_instance.get_data();
|
||||
@ -741,8 +740,9 @@ PyObject* PyModules::get_perf_schema_python(
|
||||
} else {
|
||||
auto key = DaemonKey(svc_type, svc_id);
|
||||
// so that the below can be a loop in all cases
|
||||
if (daemon_state.exists(key)) {
|
||||
states[key] = daemon_state.get(key);
|
||||
auto got = daemon_state.get(key);
|
||||
if (got != nullptr) {
|
||||
states[key] = got;
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user