diff --git a/controller/DB.hpp b/controller/DB.hpp index 64bd83af0..b05a2b11e 100644 --- a/controller/DB.hpp +++ b/controller/DB.hpp @@ -35,6 +35,8 @@ #include +#include + #define ZT_MEMBER_AUTH_TIMEOUT_NOTIFY_BEFORE 25000 namespace ZeroTier @@ -188,6 +190,9 @@ protected: std::unordered_multimap< uint64_t,uint64_t > _networkByMember; mutable std::mutex _changeListeners_l; mutable std::mutex _networks_l; + + prometheus::simpleapi::counter_metric_t _network_count { "contrller_network_count", "number of networks the controller is serving" }; + prometheus::simpleapi::counter_metric_t _member_count { "controller_member_count", "number of network members the controller is serving" }; }; } // namespace ZeroTier diff --git a/controller/PostgreSQL.cpp b/controller/PostgreSQL.cpp index 626fa4c26..8bcfec4d7 100644 --- a/controller/PostgreSQL.cpp +++ b/controller/PostgreSQL.cpp @@ -720,6 +720,7 @@ void PostgreSQL::initializeNetworks() fprintf(stderr, "Took %llu us per network to load\n", (total/count)); } stream.complete(); + _network_count = count; w.commit(); _pool->unborrow(c2); @@ -1034,7 +1035,6 @@ void PostgreSQL::heartbeat() w.commit(); } catch (std::exception &e) { fprintf(stderr, "%s: Heartbeat update failed: %s\n", controllerId, e.what()); - w.abort(); _pool->unborrow(c); std::this_thread::sleep_for(std::chrono::milliseconds(1000)); continue; diff --git a/zeroidc/Cargo.toml b/zeroidc/Cargo.toml index 0e3c812af..33af91b0c 100644 --- a/zeroidc/Cargo.toml +++ b/zeroidc/Cargo.toml @@ -15,7 +15,7 @@ url = "2.3" reqwest = "0.11" jwt = {version = "0.16", git = "https://github.com/glimberg/rust-jwt"} serde = "1.0" -time = { version = "0.3", features = ["formatting"] } +time = { version = "~0.3", features = ["formatting"] } bytes = "1.3" thiserror = "1" tokio = { version = ">=1.24" }