Add support to use the field name in rdci

In the rdci dmon and fieldgroup, now the fields can be specified
using either number id or the field name.

When the rdc is async fetching metrics, it will not report that fetch
as an error.

Change-Id: I81331e2c239af987181147be5ac0e29ba1617ab4
This commit is contained in:
Bill(Shuzhou) Liu
2020-05-19 09:38:50 -04:00
zatwierdzone przez Chris Freehill
rodzic 76162057a1
commit d30cb81fdb
6 zmienionych plików z 60 dodań i 12 usunięć
+8 -3
Wyświetl plik
@@ -147,10 +147,15 @@ void RdciDmonSubSystem::parse_cmd_opts(int argc, char ** argv) {
std::vector<std::string> vec_ids = split_string(field_ids, ',');
for (uint32_t i = 0; i < vec_ids.size(); i++) {
if (!IsNumber(vec_ids[i])) {
throw RdcException(RDC_ST_BAD_PARAMETER, "The field Id "
+vec_ids[i]+" needs to be a number");
uint32_t field_id = 0;
if (!get_field_id_from_name(vec_ids[i], field_id)) {
throw RdcException(RDC_ST_BAD_PARAMETER,
"The field name "+vec_ids[i]+" is not valid");
}
field_ids_.push_back(field_id);
} else {
field_ids_.push_back(std::stoi(vec_ids[i]));
}
field_ids_.push_back(std::stoi(vec_ids[i]));
}
}
}