e2sm_kpm: simplify metric collection in e2sm_kpm_report_service

master
Piotr Gawlowicz 2 years ago committed by Justin Tallon
parent c7c4fb85e3
commit 14c1ed97d3

@ -58,8 +58,7 @@ private:
bool _get_meas_definition(std::string meas_name, E2SM_KPM_metric_t& def); bool _get_meas_definition(std::string meas_name, E2SM_KPM_metric_t& def);
std::vector<std::string> _get_supported_meas(uint32_t level_mask); std::vector<std::string> _get_supported_meas(uint32_t level_mask);
bool _collect_integer_type_meas_value(E2SM_KPM_meas_def_t& meas_value, meas_record_item_c& item); bool _collect_type_meas_value(E2SM_KPM_meas_def_t& meas_value, meas_record_item_c& item);
bool _collect_real_type_meas_value(E2SM_KPM_meas_def_t& meas_value, meas_record_item_c& item);
bool bool
_extract_integer_type_meas_value(E2SM_KPM_meas_def_t& meas_value, const enb_metrics_t& enb_metrics, uint32_t& value); _extract_integer_type_meas_value(E2SM_KPM_meas_def_t& meas_value, const enb_metrics_t& enb_metrics, uint32_t& value);
bool _extract_real_type_meas_value(E2SM_KPM_meas_def_t& meas_value, const enb_metrics_t& enb_metrics, float& value); bool _extract_real_type_meas_value(E2SM_KPM_meas_def_t& meas_value, const enb_metrics_t& enb_metrics, float& value);

@ -336,20 +336,17 @@ void e2sm_kpm::receive_e2_metrics_callback(const enb_metrics_t& m)
logger.debug("e2sm_kpm received new enb metrics, CPU0 Load: %.1f", last_enb_metrics.sys.cpu_load[0]); logger.debug("e2sm_kpm received new enb metrics, CPU0 Load: %.1f", last_enb_metrics.sys.cpu_load[0]);
} }
bool e2sm_kpm::_collect_integer_type_meas_value(E2SM_KPM_meas_def_t& meas_value, meas_record_item_c& item) bool e2sm_kpm::_collect_type_meas_value(E2SM_KPM_meas_def_t& meas_value, meas_record_item_c& item)
{ {
// here we implement logic of measurement data collection, currently we only read from enb_metrics // here we implement logic of measurement data collection, currently we only read from enb_metrics
if (meas_value.data_type == meas_record_item_c::types::options::integer) {
uint32_t value; uint32_t value;
if (_extract_integer_type_meas_value(meas_value, last_enb_metrics, value)) { if (_extract_integer_type_meas_value(meas_value, last_enb_metrics, value)) {
item.set_integer() = value; item.set_integer() = value;
return true; return true;
} }
return false; } else {
} // data_type == meas_record_item_c::types::options::real;
bool e2sm_kpm::_collect_real_type_meas_value(E2SM_KPM_meas_def_t& meas_value, meas_record_item_c& item)
{
// here we implement logic of measurement data collection, currently we only read from enb_metrics
float value; float value;
if (_extract_real_type_meas_value(meas_value, last_enb_metrics, value)) { if (_extract_real_type_meas_value(meas_value, last_enb_metrics, value)) {
real_s real_value; real_s real_value;
@ -358,6 +355,8 @@ bool e2sm_kpm::_collect_real_type_meas_value(E2SM_KPM_meas_def_t& meas_value, me
item.set_real() = real_value; item.set_real() = real_value;
return true; return true;
} }
}
return false; return false;
} }

@ -380,18 +380,11 @@ bool e2sm_kpm_report_service_style1::_collect_meas_data()
meas_value.data_type = data_type; meas_value.data_type = data_type;
meas_record_item_c item; meas_record_item_c item;
if (meas_value.data_type == meas_record_item_c::types::options::integer) { if (not parent->_collect_type_meas_value(meas_value, item)) {
if (not parent->_collect_integer_type_meas_value(meas_value, item)) {
parent->logger.info("Cannot extract value \"%s\" label: %i", meas_name.c_str(), label); parent->logger.info("Cannot extract value \"%s\" label: %i", meas_name.c_str(), label);
return false; return false;
} }
} else {
// data_type == meas_record_item_c::types::options::real;
if (not parent->_collect_real_type_meas_value(meas_value, item)) {
parent->logger.info("Cannot extract value \"%s\" label %i", meas_name.c_str(), label);
return false;
}
}
// save meas value in the proper record list // save meas value in the proper record list
meas_data_item.meas_record.push_back(item); meas_data_item.meas_record.push_back(item);
} }

Loading…
Cancel
Save