mirror of
https://github.com/zerotier/ZeroTierOne.git
synced 2025-04-22 15:06:54 +02:00
Adding peer metrics
still need to be wired up for use
This commit is contained in:
parent
925599cab0
commit
289f231677
4 changed files with 16 additions and 6 deletions
|
@ -176,6 +176,12 @@ namespace ZeroTier {
|
|||
prometheus::simpleapi::counter_family_t network_outgoing_packets
|
||||
{ "zt_network_outgoing_packets", "number of outgoing packets per network" };
|
||||
|
||||
// PeerMetrics
|
||||
prometheus::CustomFamily<prometheus::Histogram<uint64_t>> peer_latency
|
||||
{ "zt_peer_latency", "peer latency (ms)", {{}}};
|
||||
prometheus::simpleapi::gauge_family_t peer_path_count
|
||||
{ "zt_peer_path_count", "number of paths to peer" };
|
||||
|
||||
// General Controller Metrics
|
||||
prometheus::simpleapi::gauge_metric_t network_count
|
||||
{"controller_network_count", "number of networks the controller is serving"};
|
||||
|
|
|
@ -107,6 +107,10 @@ namespace ZeroTier {
|
|||
extern prometheus::simpleapi::counter_family_t network_incoming_packets;
|
||||
extern prometheus::simpleapi::counter_family_t network_outgoing_packets;
|
||||
|
||||
// Peer Metrics
|
||||
extern prometheus::CustomFamily<prometheus::Histogram<uint64_t>> peer_latency;
|
||||
extern prometheus::simpleapi::gauge_family_t peer_path_count;
|
||||
|
||||
// General Controller Metrics
|
||||
extern prometheus::simpleapi::gauge_metric_t network_count;
|
||||
extern prometheus::simpleapi::gauge_metric_t member_count;
|
||||
|
|
|
@ -28,11 +28,6 @@ namespace ZeroTier {
|
|||
|
||||
static unsigned char s_freeRandomByteCounter = 0;
|
||||
|
||||
char * peerIDString(const Identity &id) {
|
||||
char out[16];
|
||||
return id.address().toString(out);
|
||||
}
|
||||
|
||||
Peer::Peer(const RuntimeEnvironment *renv,const Identity &myIdentity,const Identity &peerIdentity) :
|
||||
RR(renv),
|
||||
_lastReceive(0),
|
||||
|
@ -55,7 +50,9 @@ Peer::Peer(const RuntimeEnvironment *renv,const Identity &myIdentity,const Ident
|
|||
_directPathPushCutoffCount(0),
|
||||
_echoRequestCutoffCount(0),
|
||||
_localMultipathSupported(false),
|
||||
_lastComputedAggregateMeanLatency(0)
|
||||
_lastComputedAggregateMeanLatency(0),
|
||||
_peer_latency{Metrics::peer_latency.Add({{"node_id", OSUtils::nodeIDStr(peerIdentity.address().toInt())}}, std::vector<uint64_t>{1,3,6,10,30,60,100,300,600,1000})},
|
||||
_path_count{Metrics::peer_path_count.Add({{"node_id", OSUtils::nodeIDStr(peerIdentity.address().toInt())}})}
|
||||
{
|
||||
if (!myIdentity.agree(peerIdentity,_key)) {
|
||||
throw ZT_EXCEPTION_INVALID_ARGUMENT;
|
||||
|
|
|
@ -598,6 +598,9 @@ private:
|
|||
int32_t _lastComputedAggregateMeanLatency;
|
||||
|
||||
SharedPtr<Bond> _bond;
|
||||
|
||||
prometheus::Histogram<uint64_t> _peer_latency;
|
||||
prometheus::simpleapi::gauge_metric_t _path_count;
|
||||
};
|
||||
|
||||
} // namespace ZeroTier
|
||||
|
|
Loading…
Add table
Reference in a new issue