Skip to content
Snippets Groups Projects
Commit 939fe037 authored by Cedric Caffy's avatar Cedric Caffy
Browse files

Sanitized the JSON output of the statistics

parent e32d1f7d
No related branches found
No related tags found
No related merge requests found
......@@ -59,7 +59,6 @@ uint64_t Statistics::getTotalBytes() const {
return m_totalBytes;
}
Statistics::Builder::Builder(cta::rdbms::Rset & rset):m_rset(rset) {}
std::unique_ptr<Statistics> Statistics::Builder::build(){
......@@ -80,21 +79,21 @@ std::unique_ptr<Statistics> Statistics::Builder::build(){
std::ostream & operator <<(std::ostream& stream, Statistics stats) {
stream << "{";
stream << "[";
stream << "\"statisticsPerVo\": [";
for(auto & stat: stats.getAllStatistics()){
stream << "{";
stream << "vo: " << stat.first << ",";
stream << "nbMasterFiles: " << stat.second.nbMasterFiles << ",";
stream << "masterDataInBytes: " << stat.second.masterDataInBytes << ",";
stream << "nbCopyNb1: " << stat.second.nbCopyNb1 << ",";
stream << "copyNb1InBytes: " << stat.second.copyNb1InBytes << ",";
stream << "nbCopyNbGt1: " << stat.second.nbCopyNbGt1 << ",";
stream << "copyNbGt1InBytes: " << stat.second.copyNbGt1InBytes;
stream << "}";
stream << "\"vo\": \"" << stat.first << "\",";
stream << "\"nbMasterFiles\": " << stat.second.nbMasterFiles << ",";
stream << "\"masterDataInBytes\": " << stat.second.masterDataInBytes << ",";
stream << "\"nbCopyNb1\": " << stat.second.nbCopyNb1 << ",";
stream << "\"copyNb1InBytes\": " << stat.second.copyNb1InBytes << ",";
stream << "\"nbCopyNbGt1\": " << stat.second.nbCopyNbGt1 << ",";
stream << "\"copyNbGt1InBytes\": " << stat.second.copyNbGt1InBytes;
stream << "},";
}
stream << "],";
stream << "totalFiles: " << stats.getTotalFiles() << ",";
stream << "totalBytes: " << stats.getTotalBytes();
stream << "\"totalFiles\": " << stats.getTotalFiles() << ",";
stream << "\"totalBytes\": " << stats.getTotalBytes();
stream << "}";
return stream;
}
......
......@@ -86,7 +86,17 @@ int StatisticsSaveCmd::exceptionThrowingMain(const int argc, char *const *const
SchemaChecker::Builder catalogueCheckerBuilder("catalogue",loginCatalogue.dbType,catalogueConn);
std::unique_ptr<cta::catalogue::SchemaChecker> catalogueChecker = catalogueCheckerBuilder.build();
SchemaChecker::Status tapeTableStatus = catalogueChecker->checkTableContainsColumns("TAPE",{"VID","NB_MASTER_FILES","MASTER_DATA_IN_BYTES","DIRTY"});
SchemaChecker::Status tapeTableStatus =
catalogueChecker->checkTableContainsColumns("TAPE",{"VID",
"NB_MASTER_FILES",
"MASTER_DATA_IN_BYTES",
"NB_COPY_NB_1",
"COPY_NB_1_IN_BYTES",
"NB_COPY_NB_GT_1",
"COPY_NB_GT_1_IN_BYTES",
"DIRTY"
}
);
if(tapeTableStatus == SchemaChecker::Status::FAILURE){
return EXIT_FAILURE;
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment