mirror of
https://github.com/zerotier/ZeroTierOne.git
synced 2025-06-05 20:13:44 +02:00
per peer packet metrics
This commit is contained in:
parent
289f231677
commit
3b7883f7bf
4 changed files with 19 additions and 2 deletions
|
@ -181,6 +181,12 @@ namespace ZeroTier {
|
|||
{ "zt_peer_latency", "peer latency (ms)", {{}}};
|
||||
prometheus::simpleapi::gauge_family_t peer_path_count
|
||||
{ "zt_peer_path_count", "number of paths to peer" };
|
||||
prometheus::simpleapi::counter_family_t peer_incoming_packets
|
||||
{ "zt_peer_incoming_packets", "number of incoming packets from a peer" };
|
||||
prometheus::simpleapi::counter_family_t peer_outgoing_packets
|
||||
{ "zt_peer_outgoing_packets", "number of outgoing packets to a peer" };
|
||||
prometheus::simpleapi::counter_family_t peer_packet_errors
|
||||
{ "zt_peer_packet_errors" , "number of incoming packet errors from a peer" };
|
||||
|
||||
// General Controller Metrics
|
||||
prometheus::simpleapi::gauge_metric_t network_count
|
||||
|
|
|
@ -110,6 +110,9 @@ namespace ZeroTier {
|
|||
// Peer Metrics
|
||||
extern prometheus::CustomFamily<prometheus::Histogram<uint64_t>> peer_latency;
|
||||
extern prometheus::simpleapi::gauge_family_t peer_path_count;
|
||||
extern prometheus::simpleapi::counter_family_t peer_incoming_packets;
|
||||
extern prometheus::simpleapi::counter_family_t peer_outgoing_packets;
|
||||
extern prometheus::simpleapi::counter_family_t peer_packet_errors;
|
||||
|
||||
// General Controller Metrics
|
||||
extern prometheus::simpleapi::gauge_metric_t network_count;
|
||||
|
|
|
@ -52,7 +52,10 @@ Peer::Peer(const RuntimeEnvironment *renv,const Identity &myIdentity,const Ident
|
|||
_localMultipathSupported(false),
|
||||
_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())}})}
|
||||
_path_count{Metrics::peer_path_count.Add({{"node_id", OSUtils::nodeIDStr(peerIdentity.address().toInt())}})},
|
||||
_incoming_packet{Metrics::peer_incoming_packets.Add({{"node_id", OSUtils::nodeIDStr(peerIdentity.address().toInt())}})},
|
||||
_outgoing_packet{Metrics::peer_outgoing_packets.Add({{"node_id", OSUtils::nodeIDStr(peerIdentity.address().toInt())}})},
|
||||
_packet_errors{Metrics::peer_packet_errors.Add({{"node_id", OSUtils::nodeIDStr(peerIdentity.address().toInt())}})}
|
||||
{
|
||||
if (!myIdentity.agree(peerIdentity,_key)) {
|
||||
throw ZT_EXCEPTION_INVALID_ARGUMENT;
|
||||
|
@ -93,7 +96,7 @@ void Peer::received(
|
|||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
_incoming_packet++;
|
||||
recordIncomingPacket(path, packetId, payloadLength, verb, flowId, now);
|
||||
|
||||
if (trustEstablished) {
|
||||
|
@ -645,6 +648,7 @@ void Peer::recordOutgoingPacket(const SharedPtr<Path> &path, const uint64_t pack
|
|||
|
||||
void Peer::recordIncomingInvalidPacket(const SharedPtr<Path>& path)
|
||||
{
|
||||
_packet_errors++;
|
||||
if (_localMultipathSupported && _bond) {
|
||||
_bond->recordIncomingInvalidPacket(path);
|
||||
}
|
||||
|
|
|
@ -144,6 +144,7 @@ public:
|
|||
{
|
||||
SharedPtr<Path> bp(getAppropriatePath(now,force));
|
||||
if (bp) {
|
||||
_outgoing_packet++;
|
||||
return bp->send(RR,tPtr,data,len,now);
|
||||
}
|
||||
return false;
|
||||
|
@ -601,6 +602,9 @@ private:
|
|||
|
||||
prometheus::Histogram<uint64_t> _peer_latency;
|
||||
prometheus::simpleapi::gauge_metric_t _path_count;
|
||||
prometheus::simpleapi::counter_metric_t _incoming_packet;
|
||||
prometheus::simpleapi::counter_metric_t _outgoing_packet;
|
||||
prometheus::simpleapi::counter_metric_t _packet_errors;
|
||||
};
|
||||
|
||||
} // namespace ZeroTier
|
||||
|
|
Loading…
Add table
Reference in a new issue