Skip to content

Commit

Permalink
monitoring lowercase namespace (#8)
Browse files Browse the repository at this point in the history
  • Loading branch information
awegrzyn authored and Barthelemy committed Apr 19, 2018
1 parent 40ac89f commit 972ba34
Show file tree
Hide file tree
Showing 5 changed files with 24 additions and 25 deletions.
2 changes: 1 addition & 1 deletion Framework/include/QualityControl/Checker.h
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,7 @@ class Checker : public FairMQDevice
std::map<std::string,TClass*> mClassesLoaded;

// monitoring
std::shared_ptr<AliceO2::Monitoring::Collector> mCollector;
std::shared_ptr<o2::monitoring::Monitoring> mCollector;
std::chrono::system_clock::time_point startFirstObject;
std::chrono::system_clock::time_point endLastObject;
int mTotalNumberHistosReceived = 0;
Expand Down
2 changes: 1 addition & 1 deletion Framework/include/QualityControl/TaskDevice.h
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ class TaskDevice : public FairMQDevice
std::string mTaskName;
TaskConfig mTaskConfig;
std::unique_ptr<AliceO2::Configuration::ConfigurationInterface> mConfigFile;
std::unique_ptr<AliceO2::Monitoring::Collector> mCollector;
std::unique_ptr<o2::monitoring::Monitoring> mCollector;
std::unique_ptr<AliceO2::DataSampling::SamplerInterface> mSampler;
o2::quality_control::core::TaskInterface *mTask;
std::shared_ptr<ObjectsManager> mObjectsManager;
Expand Down
11 changes: 5 additions & 6 deletions Framework/src/Checker.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down Expand Up @@ -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;
Expand Down Expand Up @@ -132,10 +131,10 @@ Checker::~Checker()

// Monitoring
std::chrono::duration<double> 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)
Expand Down Expand Up @@ -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
Expand Down
32 changes: 16 additions & 16 deletions Framework/src/TaskDevice.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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();
}
}
Expand Down Expand Up @@ -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<std::string> 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()
Expand Down Expand Up @@ -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)
Expand Down
2 changes: 1 addition & 1 deletion cmake/FindMonitoring.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down

0 comments on commit 972ba34

Please sign in to comment.