summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDan Goodliffe <dan@randomdan.homeip.net>2022-07-23 18:13:36 +0100
committerDan Goodliffe <dan@randomdan.homeip.net>2022-07-23 18:13:36 +0100
commit5bec6e3f18a6be44e4e29d53e618c1e114223555 (patch)
treed80e140148a2a17cf28d3c8d6da6e950b8af1f84
parentPackage description can be empty string (diff)
downloadgentoobrowse-api-5bec6e3f18a6be44e4e29d53e618c1e114223555.tar.bz2
gentoobrowse-api-5bec6e3f18a6be44e4e29d53e618c1e114223555.tar.xz
gentoobrowse-api-5bec6e3f18a6be44e4e29d53e618c1e114223555.zip
Include performance data
-rw-r--r--gentoobrowse-api/service/maintenanceBugs.cpp4
-rw-r--r--gentoobrowse-api/service/maintenanceGitOperations.cpp9
2 files changed, 9 insertions, 4 deletions
diff --git a/gentoobrowse-api/service/maintenanceBugs.cpp b/gentoobrowse-api/service/maintenanceBugs.cpp
index b40c130..d7832fd 100644
--- a/gentoobrowse-api/service/maintenanceBugs.cpp
+++ b/gentoobrowse-api/service/maintenanceBugs.cpp
@@ -93,6 +93,7 @@ namespace Gentoo::Service {
AdHocFormatter(UpdatingBugs, "Refreshing bug list from %?");
AdHocFormatter(UpdatingBugUrl, " ... %?");
AdHocFormatter(UpdatingBugsResult, "Refreshed bug list: %? added, %? updated, %? removed");
+ AdHocFormatter(UpdatingBugsResultPerf, "|added=%? updated=%? removed=%?");
constexpr const std::string_view NagiosServiceName("GB API Bug Updates");
void
Maintenance::refreshBugs(const Ice::Current & c)
@@ -125,7 +126,8 @@ namespace Gentoo::Service {
log->messagectf<UpdatingBugsResult>(
IceTray::Logging::LogLevel::INFO, result.inserts, result.updates, result.deletes);
AdHoc::submitNagiosPassiveServiceCheck(NagiosServiceName, AdHoc::NagiosStatusCode::OK,
- UpdatingBugsResult::get(result.inserts, result.updates, result.deletes));
+ UpdatingBugsResult::get(result.inserts, result.updates, result.deletes)
+ + UpdatingBugsResultPerf::get(result.inserts, result.updates, result.deletes));
}
catch (const std::exception & ex) {
AdHoc::submitNagiosPassiveServiceCheck(NagiosServiceName, AdHoc::NagiosStatusCode::Warning, ex.what());
diff --git a/gentoobrowse-api/service/maintenanceGitOperations.cpp b/gentoobrowse-api/service/maintenanceGitOperations.cpp
index a91116b..a5a9ed0 100644
--- a/gentoobrowse-api/service/maintenanceGitOperations.cpp
+++ b/gentoobrowse-api/service/maintenanceGitOperations.cpp
@@ -185,7 +185,7 @@ namespace Gentoo::Service {
return changes;
}
- constexpr const std::string_view NagiosServiceName("GB API Package Updates");
+ AdHocFormatter(NagiosServiceUpdate, "GB API Package Updates|changes=%?");
void
Maintenance::refreshPackageTree(const Ice::Current & c)
{
@@ -194,17 +194,20 @@ namespace Gentoo::Service {
auto repoRoot = std::filesystem::path(properties->getPropertyWithDefault("GentooBrowseAPI.RepoRoot", "/"));
auto dbc = db->get();
DB::TransactionScope tx(*dbc.get());
+ size_t total {};
for (const auto & repo : fetch<Gentoo::Repositories>(dbc.get(), sql::maintenance::reposToGitRefresh)) {
auto changes = refreshRepository(dbc.get(), properties, repo);
+ total += changes.size();
this->applyFileChanges(dbc.get(), repoRoot, repo, changes);
}
time_t now = time(nullptr);
sd_notifyf(0, "STATUS=Last update %s", ctime(&now));
AdHoc::submitNagiosPassiveServiceCheck(
- NagiosServiceName, AdHoc::NagiosStatusCode::OK, "Package tree(s) updated");
+ NagiosServiceUpdate::get(total), AdHoc::NagiosStatusCode::OK, "Package tree(s) updated");
}
catch (const std::exception & ex) {
- AdHoc::submitNagiosPassiveServiceCheck(NagiosServiceName, AdHoc::NagiosStatusCode::Warning, ex.what());
+ AdHoc::submitNagiosPassiveServiceCheck(
+ NagiosServiceUpdate::get(0), AdHoc::NagiosStatusCode::Warning, ex.what());
throw;
}
}