mirror of
https://github.com/ZeroTier/ZeroTierOne
synced 2025-08-24 07:05:50 -07:00
Disable peer metrics for controllers pt 2
This commit is contained in:
parent
ed9ffdb4f2
commit
e12fa2b2c5
2 changed files with 43 additions and 29 deletions
|
@ -28,35 +28,37 @@ namespace ZeroTier {
|
||||||
|
|
||||||
static unsigned char s_freeRandomByteCounter = 0;
|
static unsigned char s_freeRandomByteCounter = 0;
|
||||||
|
|
||||||
Peer::Peer(const RuntimeEnvironment *renv,const Identity &myIdentity,const Identity &peerIdentity) :
|
Peer::Peer(const RuntimeEnvironment *renv,const Identity &myIdentity,const Identity &peerIdentity)
|
||||||
RR(renv),
|
: RR(renv)
|
||||||
_lastReceive(0),
|
, _lastReceive(0)
|
||||||
_lastNontrivialReceive(0),
|
, _lastNontrivialReceive(0)
|
||||||
_lastTriedMemorizedPath(0),
|
, _lastTriedMemorizedPath(0)
|
||||||
_lastDirectPathPushSent(0),
|
, _lastDirectPathPushSent(0)
|
||||||
_lastDirectPathPushReceive(0),
|
, _lastDirectPathPushReceive(0)
|
||||||
_lastCredentialRequestSent(0),
|
, _lastCredentialRequestSent(0)
|
||||||
_lastWhoisRequestReceived(0),
|
, _lastWhoisRequestReceived(0)
|
||||||
_lastCredentialsReceived(0),
|
, _lastCredentialsReceived(0)
|
||||||
_lastTrustEstablishedPacketReceived(0),
|
, _lastTrustEstablishedPacketReceived(0)
|
||||||
_lastSentFullHello(0),
|
, _lastSentFullHello(0)
|
||||||
_lastEchoCheck(0),
|
, _lastEchoCheck(0)
|
||||||
_freeRandomByte((unsigned char)((uintptr_t)this >> 4) ^ ++s_freeRandomByteCounter),
|
, _freeRandomByte((unsigned char)((uintptr_t)this >> 4) ^ ++s_freeRandomByteCounter)
|
||||||
_vProto(0),
|
, _vProto(0)
|
||||||
_vMajor(0),
|
, _vMajor(0)
|
||||||
_vMinor(0),
|
, _vMinor(0)
|
||||||
_vRevision(0),
|
, _vRevision(0)
|
||||||
_id(peerIdentity),
|
, _id(peerIdentity)
|
||||||
_directPathPushCutoffCount(0),
|
, _directPathPushCutoffCount(0)
|
||||||
_echoRequestCutoffCount(0),
|
, _echoRequestCutoffCount(0)
|
||||||
_localMultipathSupported(false),
|
, _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})},
|
#ifndef ZT_NO_PEER_METRICS
|
||||||
_alive_path_count{Metrics::peer_path_count.Add({{"node_id", OSUtils::nodeIDStr(peerIdentity.address().toInt())},{"status","alive"}})},
|
, _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})}
|
||||||
_dead_path_count{Metrics::peer_path_count.Add({{"node_id", OSUtils::nodeIDStr(peerIdentity.address().toInt())},{"status","dead"}})},
|
, _alive_path_count{Metrics::peer_path_count.Add({{"node_id", OSUtils::nodeIDStr(peerIdentity.address().toInt())},{"status","alive"}})}
|
||||||
_incoming_packet{Metrics::peer_packets.Add({{"direction", "rx"},{"node_id", OSUtils::nodeIDStr(peerIdentity.address().toInt())}})},
|
, _dead_path_count{Metrics::peer_path_count.Add({{"node_id", OSUtils::nodeIDStr(peerIdentity.address().toInt())},{"status","dead"}})}
|
||||||
_outgoing_packet{Metrics::peer_packets.Add({{"direction", "tx"},{"node_id", OSUtils::nodeIDStr(peerIdentity.address().toInt())}})},
|
, _incoming_packet{Metrics::peer_packets.Add({{"direction", "rx"},{"node_id", OSUtils::nodeIDStr(peerIdentity.address().toInt())}})}
|
||||||
_packet_errors{Metrics::peer_packet_errors.Add({{"node_id", OSUtils::nodeIDStr(peerIdentity.address().toInt())}})}
|
, _outgoing_packet{Metrics::peer_packets.Add({{"direction", "tx"},{"node_id", OSUtils::nodeIDStr(peerIdentity.address().toInt())}})}
|
||||||
|
, _packet_errors{Metrics::peer_packet_errors.Add({{"node_id", OSUtils::nodeIDStr(peerIdentity.address().toInt())}})}
|
||||||
|
#endif
|
||||||
{
|
{
|
||||||
if (!myIdentity.agree(peerIdentity,_key)) {
|
if (!myIdentity.agree(peerIdentity,_key)) {
|
||||||
throw ZT_EXCEPTION_INVALID_ARGUMENT;
|
throw ZT_EXCEPTION_INVALID_ARGUMENT;
|
||||||
|
@ -97,7 +99,9 @@ void Peer::received(
|
||||||
default:
|
default:
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
#ifndef ZT_NO_PEER_METRICS
|
||||||
_incoming_packet++;
|
_incoming_packet++;
|
||||||
|
#endif
|
||||||
recordIncomingPacket(path, packetId, payloadLength, verb, flowId, now);
|
recordIncomingPacket(path, packetId, payloadLength, verb, flowId, now);
|
||||||
|
|
||||||
if (trustEstablished) {
|
if (trustEstablished) {
|
||||||
|
@ -569,6 +573,7 @@ unsigned int Peer::doPingAndKeepalive(void *tPtr,int64_t now)
|
||||||
deletionOccurred = false;
|
deletionOccurred = false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
#ifndef ZT_NO_PEER_METRICS
|
||||||
uint16_t alive_path_count_tmp = 0, dead_path_count_tmp = 0;
|
uint16_t alive_path_count_tmp = 0, dead_path_count_tmp = 0;
|
||||||
for(unsigned int i=0;i<ZT_MAX_PEER_NETWORK_PATHS;++i) {
|
for(unsigned int i=0;i<ZT_MAX_PEER_NETWORK_PATHS;++i) {
|
||||||
if (_paths[i].p) {
|
if (_paths[i].p) {
|
||||||
|
@ -582,8 +587,11 @@ unsigned int Peer::doPingAndKeepalive(void *tPtr,int64_t now)
|
||||||
}
|
}
|
||||||
_alive_path_count = alive_path_count_tmp;
|
_alive_path_count = alive_path_count_tmp;
|
||||||
_dead_path_count = dead_path_count_tmp;
|
_dead_path_count = dead_path_count_tmp;
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
#ifndef ZT_NO_PEER_METRICS
|
||||||
_peer_latency.Observe(latency(now));
|
_peer_latency.Observe(latency(now));
|
||||||
|
#endif
|
||||||
return sent;
|
return sent;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -658,7 +666,9 @@ void Peer::resetWithinScope(void *tPtr,InetAddress::IpScope scope,int inetAddres
|
||||||
void Peer::recordOutgoingPacket(const SharedPtr<Path> &path, const uint64_t packetId,
|
void Peer::recordOutgoingPacket(const SharedPtr<Path> &path, const uint64_t packetId,
|
||||||
uint16_t payloadLength, const Packet::Verb verb, const int32_t flowId, int64_t now)
|
uint16_t payloadLength, const Packet::Verb verb, const int32_t flowId, int64_t now)
|
||||||
{
|
{
|
||||||
|
#ifndef ZT_NO_PEER_METRICS
|
||||||
_outgoing_packet++;
|
_outgoing_packet++;
|
||||||
|
#endif
|
||||||
if (_localMultipathSupported && _bond) {
|
if (_localMultipathSupported && _bond) {
|
||||||
_bond->recordOutgoingPacket(path, packetId, payloadLength, verb, flowId, now);
|
_bond->recordOutgoingPacket(path, packetId, payloadLength, verb, flowId, now);
|
||||||
}
|
}
|
||||||
|
@ -666,7 +676,9 @@ void Peer::recordOutgoingPacket(const SharedPtr<Path> &path, const uint64_t pack
|
||||||
|
|
||||||
void Peer::recordIncomingInvalidPacket(const SharedPtr<Path>& path)
|
void Peer::recordIncomingInvalidPacket(const SharedPtr<Path>& path)
|
||||||
{
|
{
|
||||||
|
#ifndef ZT_NO_PEER_METRICS
|
||||||
_packet_errors++;
|
_packet_errors++;
|
||||||
|
#endif
|
||||||
if (_localMultipathSupported && _bond) {
|
if (_localMultipathSupported && _bond) {
|
||||||
_bond->recordIncomingInvalidPacket(path);
|
_bond->recordIncomingInvalidPacket(path);
|
||||||
}
|
}
|
||||||
|
|
|
@ -599,12 +599,14 @@ private:
|
||||||
|
|
||||||
SharedPtr<Bond> _bond;
|
SharedPtr<Bond> _bond;
|
||||||
|
|
||||||
|
#ifndef ZT_NO_PEER_METRICS
|
||||||
prometheus::Histogram<uint64_t> &_peer_latency;
|
prometheus::Histogram<uint64_t> &_peer_latency;
|
||||||
prometheus::simpleapi::gauge_metric_t _alive_path_count;
|
prometheus::simpleapi::gauge_metric_t _alive_path_count;
|
||||||
prometheus::simpleapi::gauge_metric_t _dead_path_count;
|
prometheus::simpleapi::gauge_metric_t _dead_path_count;
|
||||||
prometheus::simpleapi::counter_metric_t _incoming_packet;
|
prometheus::simpleapi::counter_metric_t _incoming_packet;
|
||||||
prometheus::simpleapi::counter_metric_t _outgoing_packet;
|
prometheus::simpleapi::counter_metric_t _outgoing_packet;
|
||||||
prometheus::simpleapi::counter_metric_t _packet_errors;
|
prometheus::simpleapi::counter_metric_t _packet_errors;
|
||||||
|
#endif
|
||||||
};
|
};
|
||||||
|
|
||||||
} // namespace ZeroTier
|
} // namespace ZeroTier
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue