exporter: avoid stoi for empty pid_str

Fixes: https://tracker.ceph.com/issues/57619
Signed-off-by: Avan Thakkar <athakkar@redhat.com>
This commit is contained in:
Avan Thakkar 2022-09-21 02:00:31 +05:30
parent 870fbefd4d
commit cff3cf1d31

View File

@ -129,7 +129,9 @@ void DaemonMetricCollector::dump_asok_metrics() {
dout(1) << "pid path is empty; process metrics won't be fetched for: "
<< daemon_name << dendl;
}
daemon_pids.push_back({daemon_name, std::stoi(pid_str)});
if (!pid_str.empty()) {
daemon_pids.push_back({daemon_name, std::stoi(pid_str)});
}
json_object dump = boost::json::parse(perf_dump_response).as_object();
json_object schema = boost::json::parse(perf_schema_response).as_object();
for (auto &perf : schema) {