diff --git a/Framework/include/QualityControl/Checker.h b/Framework/include/QualityControl/Checker.h index f9a72ffb8c..9d72101e96 100644 --- a/Framework/include/QualityControl/Checker.h +++ b/Framework/include/QualityControl/Checker.h @@ -101,7 +101,7 @@ class Checker : public FairMQDevice std::map mClassesLoaded; // monitoring - std::shared_ptr mCollector; + std::shared_ptr mCollector; std::chrono::system_clock::time_point startFirstObject; std::chrono::system_clock::time_point endLastObject; int mTotalNumberHistosReceived = 0; diff --git a/Framework/include/QualityControl/TaskDevice.h b/Framework/include/QualityControl/TaskDevice.h index 86f310d526..104f598d12 100644 --- a/Framework/include/QualityControl/TaskDevice.h +++ b/Framework/include/QualityControl/TaskDevice.h @@ -62,7 +62,7 @@ class TaskDevice : public FairMQDevice std::string mTaskName; TaskConfig mTaskConfig; std::unique_ptr mConfigFile; - std::unique_ptr mCollector; + std::unique_ptr mCollector; std::unique_ptr mSampler; o2::quality_control::core::TaskInterface *mTask; std::shared_ptr mObjectsManager; diff --git a/Framework/src/Checker.cxx b/Framework/src/Checker.cxx index 5e72c01788..51cf2c9828 100644 --- a/Framework/src/Checker.cxx +++ b/Framework/src/Checker.cxx @@ -37,7 +37,7 @@ using namespace std; using namespace AliceO2::InfoLogger; using namespace std::chrono; using namespace AliceO2::Configuration; -using namespace AliceO2::Monitoring; +using namespace o2::monitoring; namespace o2 { namespace quality_control { @@ -68,7 +68,6 @@ Checker::Checker(std::string checkerName, std::string configurationSource) // monitoring try { mCollector = MonitoringFactory::Get("infologger://"); - mCollector->addDerivedMetric("objects", AliceO2::Monitoring::DerivedMetricMode::RATE); } catch (...) { string diagnostic = boost::current_exception_diagnostic_information(); std::cerr << "Unexpected exception, diagnostic information follows:\n" << diagnostic << endl; @@ -132,10 +131,10 @@ Checker::~Checker() // Monitoring std::chrono::duration diff = endLastObject - startFirstObject; - mCollector->send(diff.count(), "QC_checker_Time_between_first_and_last_objects_received"); - mCollector->send(mTotalNumberHistosReceived, "QC_checker_Total_number_histos_treated"); + mCollector->send({diff.count(), "QC_checker_Time_between_first_and_last_objects_received"}); + mCollector->send({mTotalNumberHistosReceived, "QC_checker_Total_number_histos_treated"}); double rate = mTotalNumberHistosReceived / diff.count(); - mCollector->send(rate, "QC_checker_Rate_objects_treated_per_second_whole_run"); + mCollector->send({rate, "QC_checker_Rate_objects_treated_per_second_whole_run"}); } int size_t2int(size_t val) @@ -173,7 +172,7 @@ bool Checker::HandleData(FairMQMessagePtr &msg, int index) // if 10 seconds elapsed publish stats if (timer.isTimeout()) { timer.reset(1000000); // 10 s. - mCollector->send(mTotalNumberHistosReceived, "objects"); + mCollector->send({mTotalNumberHistosReceived, "objects"}, o2::monitoring::DerivedMetricMode::RATE); } return true; // keep running diff --git a/Framework/src/TaskDevice.cxx b/Framework/src/TaskDevice.cxx index 5c09e8bad6..6571da1c4b 100644 --- a/Framework/src/TaskDevice.cxx +++ b/Framework/src/TaskDevice.cxx @@ -19,7 +19,7 @@ namespace bpo = boost::program_options; using namespace std; using namespace std::chrono; using namespace AliceO2::Configuration; -using namespace AliceO2::Monitoring; +using namespace o2::monitoring; /* * Runner @@ -129,7 +129,7 @@ void TaskDevice::Run() double current = timer.getTime(); int objectsPublished = (mTotalNumberObjectsPublished-lastNumberObjects); lastNumberObjects = mTotalNumberObjectsPublished; - mCollector->send(objectsPublished/current, "QC_task_Rate_objects_published_per_10_seconds"); + mCollector->send({objectsPublished/current, "QC_task_Rate_objects_published_per_10_seconds"}); timer.increment(); } } @@ -163,23 +163,23 @@ void TaskDevice::monitorCycle() double durationCycle = timer.getTime(); timer.reset(); double durationPublication = timer.getTime(); - mCollector->send(numberBlocks, "QC_task_Numberofblocks_in_cycle"); - mCollector->send(durationCycle, "QC_task_Module_cycle_duration"); - mCollector->send(durationPublication, "QC_task_Publication_duration"); - mCollector->send((int) numberObjectsPublished, - "QC_task_Number_objects_published_in_cycle"); // cast due to Monitoring accepting only int + mCollector->send({numberBlocks, "QC_task_Numberofblocks_in_cycle"}); + mCollector->send({durationCycle, "QC_task_Module_cycle_duration"}); + mCollector->send({durationPublication, "QC_task_Publication_duration"}); + mCollector->send({(int) numberObjectsPublished, + "QC_task_Number_objects_published_in_cycle"}); // cast due to Monitoring accepting only int double rate = numberObjectsPublished / (durationCycle + durationPublication); - mCollector->send(rate, "QC_task_Rate_objects_published_per_second"); + mCollector->send({rate, "QC_task_Rate_objects_published_per_second"}); mTotalNumberObjectsPublished += numberObjectsPublished; //std::vector pidStatus = mMonitor->getPIDStatus(::getpid()); //pcpus(std::stod(pidStatus[3])); //pmems(std::stod(pidStatus[4])); double whole_run_rate = mTotalNumberObjectsPublished / timerTotalDurationActivity.getTime(); - mCollector->send(mTotalNumberObjectsPublished, "QC_task_Total_objects_published_whole_run"); - mCollector->send(timerTotalDurationActivity.getTime(), "QC_task_Total_duration_activity_whole_run"); - mCollector->send(whole_run_rate, "QC_task_Rate_objects_published_per_second_whole_run"); -// mCollector->send(std::stod(pidStatus[3]), "QC_task_Mean_pcpu_whole_run"); - mCollector->send(ba::mean(pmems), "QC_task_Mean_pmem_whole_run"); + mCollector->send({mTotalNumberObjectsPublished, "QC_task_Total_objects_published_whole_run"}); + mCollector->send({timerTotalDurationActivity.getTime(), "QC_task_Total_duration_activity_whole_run"}); + mCollector->send({whole_run_rate, "QC_task_Rate_objects_published_per_second_whole_run"}); +// mCollector->send({std::stod(pidStatus[3]), "QC_task_Mean_pcpu_whole_run"}); + mCollector->send({ba::mean(pmems), "QC_task_Mean_pmem_whole_run"}); } unsigned long TaskDevice::publish() @@ -228,9 +228,9 @@ void TaskDevice::endOfActivity() mTask->endOfActivity(activity); double rate = mTotalNumberObjectsPublished / timerTotalDurationActivity.getTime(); - mCollector->send(rate, "QC_task_Rate_objects_published_per_second_whole_run"); - mCollector->send(ba::mean(pcpus), "QC_task_Mean_pcpu_whole_run"); - mCollector->send(ba::mean(pmems), "QC_task_Mean_pmem_whole_run"); + mCollector->send({rate, "QC_task_Rate_objects_published_per_second_whole_run"}); + mCollector->send({ba::mean(pcpus), "QC_task_Mean_pcpu_whole_run"}); + mCollector->send({ba::mean(pmems), "QC_task_Mean_pmem_whole_run"}); } void TaskDevice::sendToInformationService(string objectsListString) diff --git a/cmake/FindMonitoring.cmake b/cmake/FindMonitoring.cmake index 453061c7eb..175d5d4702 100644 --- a/cmake/FindMonitoring.cmake +++ b/cmake/FindMonitoring.cmake @@ -20,7 +20,7 @@ include(FindPackageHandleStandardArgs) # find includes -find_path(MONITORING_INCLUDE_DIR Collector.h +find_path(MONITORING_INCLUDE_DIR Monitoring.h HINTS ${Monitoring_ROOT}/include ENV LD_LIBRARY_PATH PATH_SUFFIXES "../include/Monitoring" "../../include/Monitoring" ) # Remove the final "Monitoring"