This commit is contained in:
Grant Limberg 2023-04-19 07:56:58 -07:00
parent 8bc105b527
commit 9b5b94b515
No known key found for this signature in database
GPG Key ID: 8F2F97D3BE8D7735
3 changed files with 7 additions and 2 deletions

View File

@ -35,6 +35,8 @@
#include <nlohmann/json.hpp>
#include <prometheus/simpleapi.h>
#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

View File

@ -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;

View File

@ -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" }