From f56dcf48364121af4f25dd9552bef5fd04f9534c Mon Sep 17 00:00:00 2001 From: Grant Limberg Date: Fri, 28 Apr 2023 11:21:48 -0700 Subject: [PATCH] add tx/rx labels to packet counters allows for separately monitoring sent & received packets --- node/IncomingPacket.cpp | 54 ++++++------- node/Metrics.cpp | 171 +++++++++++++++++++++++++++------------- node/Metrics.hpp | 89 ++++++++++++++------- 3 files changed, 206 insertions(+), 108 deletions(-) diff --git a/node/IncomingPacket.cpp b/node/IncomingPacket.cpp index 12534117f..e3437cdc4 100644 --- a/node/IncomingPacket.cpp +++ b/node/IncomingPacket.cpp @@ -131,7 +131,7 @@ bool IncomingPacket::_doERROR(const RuntimeEnvironment *RR,void *tPtr,const Shar const Packet::ErrorCode errorCode = (Packet::ErrorCode)(*this)[ZT_PROTO_VERB_ERROR_IDX_ERROR_CODE]; uint64_t networkId = 0; - Metrics::pkt_error++; + Metrics::pkt_error_in++; /* Security note: we do not gate doERROR() with expectingReplyTo() to * avoid having to log every outgoing packet ID. Instead we put the @@ -148,7 +148,7 @@ bool IncomingPacket::_doERROR(const RuntimeEnvironment *RR,void *tPtr,const Shar if ((network)&&(network->controller() == peer->address())) network->setNotFound(tPtr); } - Metrics::pkt_error_obj_not_found++; + Metrics::pkt_error_obj_not_found_in++; break; case Packet::ERROR_UNSUPPORTED_OPERATION: @@ -160,7 +160,7 @@ bool IncomingPacket::_doERROR(const RuntimeEnvironment *RR,void *tPtr,const Shar if ((network)&&(network->controller() == peer->address())) network->setNotFound(tPtr); } - Metrics::pkt_error_unsupported_op++; + Metrics::pkt_error_unsupported_op_in++; break; case Packet::ERROR_IDENTITY_COLLISION: @@ -168,7 +168,7 @@ bool IncomingPacket::_doERROR(const RuntimeEnvironment *RR,void *tPtr,const Shar if (RR->topology->isUpstream(peer->identity())) { RR->node->postEvent(tPtr,ZT_EVENT_FATAL_ERROR_IDENTITY_COLLISION); } - Metrics::pkt_error_identity_collision++; + Metrics::pkt_error_identity_collision_in++; break; case Packet::ERROR_NEED_MEMBERSHIP_CERTIFICATE: { @@ -179,7 +179,7 @@ bool IncomingPacket::_doERROR(const RuntimeEnvironment *RR,void *tPtr,const Shar if ((network)&&(network->config().com)) { network->peerRequestedCredentials(tPtr,peer->address(),now); } - Metrics::pkt_error_need_membership_cert++; + Metrics::pkt_error_need_membership_cert_in++; } break; case Packet::ERROR_NETWORK_ACCESS_DENIED_: { @@ -188,7 +188,7 @@ bool IncomingPacket::_doERROR(const RuntimeEnvironment *RR,void *tPtr,const Shar if ((network)&&(network->controller() == peer->address())) { network->setAccessDenied(tPtr); } - Metrics::pkt_error_network_access_denied++; + Metrics::pkt_error_network_access_denied_in++; } break; case Packet::ERROR_UNWANTED_MULTICAST: { @@ -200,7 +200,7 @@ bool IncomingPacket::_doERROR(const RuntimeEnvironment *RR,void *tPtr,const Shar const MulticastGroup mg(MAC(field(ZT_PROTO_VERB_ERROR_IDX_PAYLOAD + 8,6),6),at(ZT_PROTO_VERB_ERROR_IDX_PAYLOAD + 14)); RR->mc->remove(network->id(),mg,peer->address()); } - Metrics::pkt_error_unwanted_multicast++; + Metrics::pkt_error_unwanted_multicast_in++; } break; case Packet::ERROR_NETWORK_AUTHENTICATION_REQUIRED: { @@ -259,7 +259,7 @@ bool IncomingPacket::_doERROR(const RuntimeEnvironment *RR,void *tPtr,const Shar network->setAuthenticationRequired(tPtr, ""); } } - Metrics::pkt_error_authentication_required++; + Metrics::pkt_error_authentication_required_in++; } break; default: break; @@ -286,13 +286,13 @@ bool IncomingPacket::_doACK(const RuntimeEnvironment* RR, void* tPtr, const Shar bond->receivedAck(_path, RR->node->now(), Utils::ntoh(ackedBytes)); } */ - Metrics::pkt_ack++; + Metrics::pkt_ack_in++; return true; } bool IncomingPacket::_doQOS_MEASUREMENT(const RuntimeEnvironment* RR, void* tPtr, const SharedPtr& peer) { - Metrics::pkt_qos++; + Metrics::pkt_qos_in++; SharedPtr bond = peer->bond(); if (! bond || ! bond->rateGateQoS(RR->node->now(), _path)) { return true; @@ -323,7 +323,7 @@ bool IncomingPacket::_doQOS_MEASUREMENT(const RuntimeEnvironment* RR, void* tPtr bool IncomingPacket::_doHELLO(const RuntimeEnvironment *RR,void *tPtr,const bool alreadyAuthenticated) { - Metrics::pkt_hello++; + Metrics::pkt_hello_in++; const int64_t now = RR->node->now(); const uint64_t pid = packetId(); @@ -526,7 +526,7 @@ bool IncomingPacket::_doHELLO(const RuntimeEnvironment *RR,void *tPtr,const bool bool IncomingPacket::_doOK(const RuntimeEnvironment *RR,void *tPtr,const SharedPtr &peer) { - Metrics::pkt_ok++; + Metrics::pkt_ok_in++; const Packet::Verb inReVerb = (Packet::Verb)(*this)[ZT_PROTO_VERB_OK_IDX_IN_RE_VERB]; const uint64_t inRePacketId = at(ZT_PROTO_VERB_OK_IDX_IN_RE_PACKET_ID); uint64_t networkId = 0; @@ -644,7 +644,7 @@ bool IncomingPacket::_doWHOIS(const RuntimeEnvironment *RR,void *tPtr,const Shar return true; } - Metrics::pkt_whois++; + Metrics::pkt_whois_in++; Packet outp(peer->address(),RR->identity.address(),Packet::VERB_OK); outp.append((unsigned char)Packet::VERB_WHOIS); @@ -678,7 +678,7 @@ bool IncomingPacket::_doWHOIS(const RuntimeEnvironment *RR,void *tPtr,const Shar bool IncomingPacket::_doRENDEZVOUS(const RuntimeEnvironment *RR,void *tPtr,const SharedPtr &peer) { - Metrics::pkt_rendezvous++; + Metrics::pkt_rendezvous_in++; if (RR->topology->isUpstream(peer->identity())) { const Address with(field(ZT_PROTO_VERB_RENDEZVOUS_IDX_ZTADDRESS,ZT_ADDRESS_LENGTH),ZT_ADDRESS_LENGTH); const SharedPtr rendezvousWith(RR->topology->getPeer(tPtr,with)); @@ -732,7 +732,7 @@ static bool _ipv6GetPayload(const uint8_t *frameData,unsigned int frameLen,unsig bool IncomingPacket::_doFRAME(const RuntimeEnvironment *RR,void *tPtr,const SharedPtr &peer,int32_t flowId) { - Metrics::pkt_frame++; + Metrics::pkt_frame_in++; int32_t _flowId = ZT_QOS_NO_FLOW; SharedPtr bond = peer->bond(); if (bond && bond->flowHashingSupported()) { @@ -825,7 +825,7 @@ bool IncomingPacket::_doFRAME(const RuntimeEnvironment *RR,void *tPtr,const Shar bool IncomingPacket::_doEXT_FRAME(const RuntimeEnvironment *RR,void *tPtr,const SharedPtr &peer,int32_t flowId) { - Metrics::pkt_ext_frame++; + Metrics::pkt_ext_frame_in++; const uint64_t nwid = at(ZT_PROTO_VERB_EXT_FRAME_IDX_NETWORK_ID); const SharedPtr network(RR->node->network(nwid)); if (network) { @@ -908,7 +908,7 @@ bool IncomingPacket::_doEXT_FRAME(const RuntimeEnvironment *RR,void *tPtr,const bool IncomingPacket::_doECHO(const RuntimeEnvironment *RR,void *tPtr,const SharedPtr &peer) { - Metrics::pkt_echo++; + Metrics::pkt_echo_in++; uint64_t now = RR->node->now(); if (!_path->rateGateEchoRequest(now)) { return true; @@ -931,7 +931,7 @@ bool IncomingPacket::_doECHO(const RuntimeEnvironment *RR,void *tPtr,const Share bool IncomingPacket::_doMULTICAST_LIKE(const RuntimeEnvironment *RR,void *tPtr,const SharedPtr &peer) { - Metrics::pkt_multicast_like++; + Metrics::pkt_multicast_like_in++; const int64_t now = RR->node->now(); bool authorized = false; uint64_t lastNwid = 0; @@ -957,7 +957,7 @@ bool IncomingPacket::_doMULTICAST_LIKE(const RuntimeEnvironment *RR,void *tPtr,c bool IncomingPacket::_doNETWORK_CREDENTIALS(const RuntimeEnvironment *RR,void *tPtr,const SharedPtr &peer) { - Metrics::pkt_network_credentials++; + Metrics::pkt_network_credentials_in++; if (!peer->rateGateCredentialsReceived(RR->node->now())) { return true; } @@ -1082,7 +1082,7 @@ bool IncomingPacket::_doNETWORK_CREDENTIALS(const RuntimeEnvironment *RR,void *t bool IncomingPacket::_doNETWORK_CONFIG_REQUEST(const RuntimeEnvironment *RR,void *tPtr,const SharedPtr &peer) { - Metrics::pkt_network_config_request++; + Metrics::pkt_network_config_request_in++; const uint64_t nwid = at(ZT_PROTO_VERB_NETWORK_CONFIG_REQUEST_IDX_NETWORK_ID); const unsigned int hopCount = hops(); const uint64_t requestPacketId = packetId(); @@ -1109,7 +1109,7 @@ bool IncomingPacket::_doNETWORK_CONFIG_REQUEST(const RuntimeEnvironment *RR,void bool IncomingPacket::_doNETWORK_CONFIG(const RuntimeEnvironment *RR,void *tPtr,const SharedPtr &peer) { - Metrics::pkt_network_config++; + Metrics::pkt_network_config_in++; const SharedPtr network(RR->node->network(at(ZT_PACKET_IDX_PAYLOAD))); if (network) { const uint64_t configUpdateId = network->handleConfigChunk(tPtr,packetId(),source(),*this,ZT_PACKET_IDX_PAYLOAD); @@ -1133,7 +1133,7 @@ bool IncomingPacket::_doNETWORK_CONFIG(const RuntimeEnvironment *RR,void *tPtr,c bool IncomingPacket::_doMULTICAST_GATHER(const RuntimeEnvironment *RR,void *tPtr,const SharedPtr &peer) { - Metrics::pkt_multicast_gather++; + Metrics::pkt_multicast_gather_in++; const uint64_t nwid = at(ZT_PROTO_VERB_MULTICAST_GATHER_IDX_NETWORK_ID); const unsigned int flags = (*this)[ZT_PROTO_VERB_MULTICAST_GATHER_IDX_FLAGS]; const MulticastGroup mg(MAC(field(ZT_PROTO_VERB_MULTICAST_GATHER_IDX_MAC,6),6),at(ZT_PROTO_VERB_MULTICAST_GATHER_IDX_ADI)); @@ -1174,7 +1174,7 @@ bool IncomingPacket::_doMULTICAST_GATHER(const RuntimeEnvironment *RR,void *tPtr bool IncomingPacket::_doMULTICAST_FRAME(const RuntimeEnvironment *RR,void *tPtr,const SharedPtr &peer) { - Metrics::pkt_multicast_frame++; + Metrics::pkt_multicast_frame_in++; const uint64_t nwid = at(ZT_PROTO_VERB_MULTICAST_FRAME_IDX_NETWORK_ID); const unsigned int flags = (*this)[ZT_PROTO_VERB_MULTICAST_FRAME_IDX_FLAGS]; @@ -1275,7 +1275,7 @@ bool IncomingPacket::_doMULTICAST_FRAME(const RuntimeEnvironment *RR,void *tPtr, bool IncomingPacket::_doPUSH_DIRECT_PATHS(const RuntimeEnvironment *RR,void *tPtr,const SharedPtr &peer) { - Metrics::pkt_push_direct_paths++; + Metrics::pkt_push_direct_paths_in++; const int64_t now = RR->node->now(); if (!peer->rateGatePushDirectPaths(now)) { @@ -1338,7 +1338,7 @@ bool IncomingPacket::_doPUSH_DIRECT_PATHS(const RuntimeEnvironment *RR,void *tPt bool IncomingPacket::_doUSER_MESSAGE(const RuntimeEnvironment *RR,void *tPtr,const SharedPtr &peer) { - Metrics::pkt_user_message++; + Metrics::pkt_user_message_in++; if (likely(size() >= (ZT_PACKET_IDX_PAYLOAD + 8))) { ZT_UserMessage um; um.origin = peer->address().toInt(); @@ -1355,7 +1355,7 @@ bool IncomingPacket::_doUSER_MESSAGE(const RuntimeEnvironment *RR,void *tPtr,con bool IncomingPacket::_doREMOTE_TRACE(const RuntimeEnvironment *RR,void *tPtr,const SharedPtr &peer) { - Metrics::pkt_remote_trace++; + Metrics::pkt_remote_trace_in++; ZT_RemoteTrace rt; const char *ptr = reinterpret_cast(data()) + ZT_PACKET_IDX_PAYLOAD; const char *const eof = reinterpret_cast(data()) + size(); @@ -1380,7 +1380,7 @@ bool IncomingPacket::_doREMOTE_TRACE(const RuntimeEnvironment *RR,void *tPtr,con bool IncomingPacket::_doPATH_NEGOTIATION_REQUEST(const RuntimeEnvironment *RR,void *tPtr,const SharedPtr &peer) { - Metrics::pkt_path_negotiation_request++; + Metrics::pkt_path_negotiation_request_in++; uint64_t now = RR->node->now(); SharedPtr bond = peer->bond(); if (!bond || !bond->rateGatePathNegotiation(now, _path)) { diff --git a/node/Metrics.cpp b/node/Metrics.cpp index 8ccef869f..cdfc04683 100644 --- a/node/Metrics.cpp +++ b/node/Metrics.cpp @@ -25,64 +25,127 @@ namespace ZeroTier { // Packet Type Counts prometheus::simpleapi::counter_family_t packets { "zt_packet_incoming", "incoming packet type counts"}; - prometheus::simpleapi::counter_metric_t pkt_error - { packets.Add({{"packet_type", "error"}}) }; - prometheus::simpleapi::counter_metric_t pkt_ack - { packets.Add({{"packet_type", "ack"}}) }; - prometheus::simpleapi::counter_metric_t pkt_qos - { packets.Add({{"packet_type", "qos"}}) }; - prometheus::simpleapi::counter_metric_t pkt_hello - { packets.Add({{"packet_type", "hello"}}) }; - prometheus::simpleapi::counter_metric_t pkt_ok - { packets.Add({{"packet_type", "ok"}}) }; - prometheus::simpleapi::counter_metric_t pkt_whois - { packets.Add({{"packet_type", "whois"}}) }; - prometheus::simpleapi::counter_metric_t pkt_rendezvous - { packets.Add({{"packet_type", "rendezvous"}}) }; - prometheus::simpleapi::counter_metric_t pkt_frame - { packets.Add({{"packet_type", "frame"}}) }; - prometheus::simpleapi::counter_metric_t pkt_ext_frame - { packets.Add({{"packet_type", "ext_frame"}}) }; - prometheus::simpleapi::counter_metric_t pkt_echo - { packets.Add({{"packet_type", "echo"}}) }; - prometheus::simpleapi::counter_metric_t pkt_multicast_like - { packets.Add({{"packet_type", "multicast_like"}}) }; - prometheus::simpleapi::counter_metric_t pkt_network_credentials - { packets.Add({{"packet_type", "network_credentials"}}) }; - prometheus::simpleapi::counter_metric_t pkt_network_config_request - { packets.Add({{"packet_type", "network_config_request"}}) }; - prometheus::simpleapi::counter_metric_t pkt_network_config - { packets.Add({{"packet_type", "network_config"}}) }; - prometheus::simpleapi::counter_metric_t pkt_multicast_gather - { packets.Add({{"packet_type", "multicast_gather"}}) }; - prometheus::simpleapi::counter_metric_t pkt_multicast_frame - { packets.Add({{"packet_type", "multicast_frame"}}) }; - prometheus::simpleapi::counter_metric_t pkt_push_direct_paths - { packets.Add({{"packet_type", "push_direct_paths"}}) }; - prometheus::simpleapi::counter_metric_t pkt_user_message - { packets.Add({{"packet_type", "user_message"}}) }; - prometheus::simpleapi::counter_metric_t pkt_remote_trace - { packets.Add({{"packet_type", "remote_trace"}}) }; - prometheus::simpleapi::counter_metric_t pkt_path_negotiation_request - { packets.Add({{"packet_type", "path_negotiation_request"}}) }; + + // Incoming packets + prometheus::simpleapi::counter_metric_t pkt_error_in + { packets.Add({{"packet_type", "error"}, {"direction", "rx"}}) }; + prometheus::simpleapi::counter_metric_t pkt_ack_in + { packets.Add({{"packet_type", "ack"}, {"direction", "rx"}}) }; + prometheus::simpleapi::counter_metric_t pkt_qos_in + { packets.Add({{"packet_type", "qos"}, {"direction", "rx"}}) }; + prometheus::simpleapi::counter_metric_t pkt_hello_in + { packets.Add({{"packet_type", "hello"}, {"direction", "rx"}}) }; + prometheus::simpleapi::counter_metric_t pkt_ok_in + { packets.Add({{"packet_type", "ok"}, {"direction", "rx"}}) }; + prometheus::simpleapi::counter_metric_t pkt_whois_in + { packets.Add({{"packet_type", "whois"}, {"direction", "rx"}}) }; + prometheus::simpleapi::counter_metric_t pkt_rendezvous_in + { packets.Add({{"packet_type", "rendezvous"}, {"direction", "rx"}}) }; + prometheus::simpleapi::counter_metric_t pkt_frame_in + { packets.Add({{"packet_type", "frame"}, {"direction", "rx"}}) }; + prometheus::simpleapi::counter_metric_t pkt_ext_frame_in + { packets.Add({{"packet_type", "ext_frame"}, {"direction", "rx"}}) }; + prometheus::simpleapi::counter_metric_t pkt_echo_in + { packets.Add({{"packet_type", "echo"}, {"direction", "rx"}}) }; + prometheus::simpleapi::counter_metric_t pkt_multicast_like_in + { packets.Add({{"packet_type", "multicast_like"}, {"direction", "rx"}}) }; + prometheus::simpleapi::counter_metric_t pkt_network_credentials_in + { packets.Add({{"packet_type", "network_credentials"}, {"direction", "rx"}}) }; + prometheus::simpleapi::counter_metric_t pkt_network_config_request_in + { packets.Add({{"packet_type", "network_config_request"}, {"direction", "rx"}}) }; + prometheus::simpleapi::counter_metric_t pkt_network_config_in + { packets.Add({{"packet_type", "network_config"}, {"direction", "rx"}}) }; + prometheus::simpleapi::counter_metric_t pkt_multicast_gather_in + { packets.Add({{"packet_type", "multicast_gather"}, {"direction", "rx"}}) }; + prometheus::simpleapi::counter_metric_t pkt_multicast_frame_in + { packets.Add({{"packet_type", "multicast_frame"}, {"direction", "rx"}}) }; + prometheus::simpleapi::counter_metric_t pkt_push_direct_paths_in + { packets.Add({{"packet_type", "push_direct_paths"}, {"direction", "rx"}}) }; + prometheus::simpleapi::counter_metric_t pkt_user_message_in + { packets.Add({{"packet_type", "user_message"}, {"direction", "rx"}}) }; + prometheus::simpleapi::counter_metric_t pkt_remote_trace_in + { packets.Add({{"packet_type", "remote_trace"}, {"direction", "rx"}}) }; + prometheus::simpleapi::counter_metric_t pkt_path_negotiation_request_in + { packets.Add({{"packet_type", "path_negotiation_request"}, {"direction", "rx"}}) }; + + // Outgoing packets + prometheus::simpleapi::counter_metric_t pkt_error_out + { packets.Add({{"packet_type", "error"}, {"direction", "tx"}}) }; + prometheus::simpleapi::counter_metric_t pkt_ack_out + { packets.Add({{"packet_type", "ack"}, {"direction", "tx"}}) }; + prometheus::simpleapi::counter_metric_t pkt_qos_out + { packets.Add({{"packet_type", "qos"}, {"direction", "tx"}}) }; + prometheus::simpleapi::counter_metric_t pkt_hello_out + { packets.Add({{"packet_type", "hello"}, {"direction", "tx"}}) }; + prometheus::simpleapi::counter_metric_t pkt_ok_out + { packets.Add({{"packet_type", "ok"}, {"direction", "tx"}}) }; + prometheus::simpleapi::counter_metric_t pkt_whois_out + { packets.Add({{"packet_type", "whois"}, {"direction", "tx"}}) }; + prometheus::simpleapi::counter_metric_t pkt_rendezvous_out + { packets.Add({{"packet_type", "rendezvous"}, {"direction", "tx"}}) }; + prometheus::simpleapi::counter_metric_t pkt_frame_out + { packets.Add({{"packet_type", "frame"}, {"direction", "tx"}}) }; + prometheus::simpleapi::counter_metric_t pkt_ext_frame_out + { packets.Add({{"packet_type", "ext_frame"}, {"direction", "tx"}}) }; + prometheus::simpleapi::counter_metric_t pkt_echo_out + { packets.Add({{"packet_type", "echo"}, {"direction", "tx"}}) }; + prometheus::simpleapi::counter_metric_t pkt_multicast_like_out + { packets.Add({{"packet_type", "multicast_like"}, {"direction", "tx"}}) }; + prometheus::simpleapi::counter_metric_t pkt_network_credentials_out + { packets.Add({{"packet_type", "network_credentials"}, {"direction", "tx"}}) }; + prometheus::simpleapi::counter_metric_t pkt_network_config_request_out + { packets.Add({{"packet_type", "network_config_request"}, {"direction", "tx"}}) }; + prometheus::simpleapi::counter_metric_t pkt_network_config_out + { packets.Add({{"packet_type", "network_config"}, {"direction", "tx"}}) }; + prometheus::simpleapi::counter_metric_t pkt_multicast_gather_out + { packets.Add({{"packet_type", "multicast_gather"}, {"direction", "tx"}}) }; + prometheus::simpleapi::counter_metric_t pkt_multicast_frame_out + { packets.Add({{"packet_type", "multicast_frame"}, {"direction", "tx"}}) }; + prometheus::simpleapi::counter_metric_t pkt_push_direct_paths_out + { packets.Add({{"packet_type", "push_direct_paths"}, {"direction", "tx"}}) }; + prometheus::simpleapi::counter_metric_t pkt_user_message_out + { packets.Add({{"packet_type", "user_message"}, {"direction", "tx"}}) }; + prometheus::simpleapi::counter_metric_t pkt_remote_trace_out + { packets.Add({{"packet_type", "remote_trace"}, {"direction", "tx"}}) }; + prometheus::simpleapi::counter_metric_t pkt_path_negotiation_request_out + { packets.Add({{"packet_type", "path_negotiation_request"}, {"direction", "tx"}}) }; + // Packet Error Counts prometheus::simpleapi::counter_family_t packet_errors { "zt_packet_incoming_error", "incoming packet errors"}; - prometheus::simpleapi::counter_metric_t pkt_error_obj_not_found - { packet_errors.Add({{"error_type", "obj_not_found"}}) }; - prometheus::simpleapi::counter_metric_t pkt_error_unsupported_op - { packet_errors.Add({{"error_type", "unsupported_operation"}}) }; - prometheus::simpleapi::counter_metric_t pkt_error_identity_collision - { packet_errors.Add({{"error_type", "identity_collision"}}) }; - prometheus::simpleapi::counter_metric_t pkt_error_need_membership_cert - { packet_errors.Add({{"error_type", "need_membership_certificate"}}) }; - prometheus::simpleapi::counter_metric_t pkt_error_network_access_denied - { packet_errors.Add({{"error_type", "network_access_denied"}}) }; - prometheus::simpleapi::counter_metric_t pkt_error_unwanted_multicast - { packet_errors.Add({{"error_type", "unwanted_multicast"}}) }; - prometheus::simpleapi::counter_metric_t pkt_error_authentication_required - { packet_errors.Add({{"error_type", "authentication_required"}}) }; + + // Incoming Error Counts + prometheus::simpleapi::counter_metric_t pkt_error_obj_not_found_in + { packet_errors.Add({{"error_type", "obj_not_found"}, {"direction", "rx"}}) }; + prometheus::simpleapi::counter_metric_t pkt_error_unsupported_op_in + { packet_errors.Add({{"error_type", "unsupported_operation"}, {"direction", "rx"}}) }; + prometheus::simpleapi::counter_metric_t pkt_error_identity_collision_in + { packet_errors.Add({{"error_type", "identity_collision"}, {"direction", "rx"}}) }; + prometheus::simpleapi::counter_metric_t pkt_error_need_membership_cert_in + { packet_errors.Add({{"error_type", "need_membership_certificate"}, {"direction", "rx"}}) }; + prometheus::simpleapi::counter_metric_t pkt_error_network_access_denied_in + { packet_errors.Add({{"error_type", "network_access_denied"}, {"direction", "rx"}}) }; + prometheus::simpleapi::counter_metric_t pkt_error_unwanted_multicast_in + { packet_errors.Add({{"error_type", "unwanted_multicast"}, {"direction", "rx"}}) }; + prometheus::simpleapi::counter_metric_t pkt_error_authentication_required_in + { packet_errors.Add({{"error_type", "authentication_required"}, {"direction", "rx"}}) }; + + // Outgoing Error Counts + prometheus::simpleapi::counter_metric_t pkt_error_obj_not_found_out + { packet_errors.Add({{"error_type", "obj_not_found"}, {"direction", "tx"}}) }; + prometheus::simpleapi::counter_metric_t pkt_error_unsupported_op_out + { packet_errors.Add({{"error_type", "unsupported_operation"}, {"direction", "tx"}}) }; + prometheus::simpleapi::counter_metric_t pkt_error_identity_collision_out + { packet_errors.Add({{"error_type", "identity_collision"}, {"direction", "tx"}}) }; + prometheus::simpleapi::counter_metric_t pkt_error_need_membership_cert_out + { packet_errors.Add({{"error_type", "need_membership_certificate"}, {"direction", "tx"}}) }; + prometheus::simpleapi::counter_metric_t pkt_error_network_access_denied_out + { packet_errors.Add({{"error_type", "network_access_denied"}, {"direction", "tx"}}) }; + prometheus::simpleapi::counter_metric_t pkt_error_unwanted_multicast_out + { packet_errors.Add({{"error_type", "unwanted_multicast"}, {"direction", "tx"}}) }; + prometheus::simpleapi::counter_metric_t pkt_error_authentication_required_out + { packet_errors.Add({{"error_type", "authentication_required"}, {"direction", "tx"}}) }; // Data Sent/Received Metrics prometheus::simpleapi::counter_metric_t udp_send diff --git a/node/Metrics.hpp b/node/Metrics.hpp index 3b65ea4b9..d11eddc86 100644 --- a/node/Metrics.hpp +++ b/node/Metrics.hpp @@ -24,36 +24,71 @@ namespace ZeroTier { namespace Metrics { // Packet Type Counts extern prometheus::simpleapi::counter_family_t packets; - extern prometheus::simpleapi::counter_metric_t pkt_error; - extern prometheus::simpleapi::counter_metric_t pkt_ack; - extern prometheus::simpleapi::counter_metric_t pkt_qos; - extern prometheus::simpleapi::counter_metric_t pkt_hello; - extern prometheus::simpleapi::counter_metric_t pkt_ok; - extern prometheus::simpleapi::counter_metric_t pkt_whois; - extern prometheus::simpleapi::counter_metric_t pkt_rendezvous; - extern prometheus::simpleapi::counter_metric_t pkt_frame; - extern prometheus::simpleapi::counter_metric_t pkt_ext_frame; - extern prometheus::simpleapi::counter_metric_t pkt_echo; - extern prometheus::simpleapi::counter_metric_t pkt_multicast_like; - extern prometheus::simpleapi::counter_metric_t pkt_network_credentials; - extern prometheus::simpleapi::counter_metric_t pkt_network_config_request; - extern prometheus::simpleapi::counter_metric_t pkt_network_config; - extern prometheus::simpleapi::counter_metric_t pkt_multicast_gather; - extern prometheus::simpleapi::counter_metric_t pkt_multicast_frame; - extern prometheus::simpleapi::counter_metric_t pkt_push_direct_paths; - extern prometheus::simpleapi::counter_metric_t pkt_user_message; - extern prometheus::simpleapi::counter_metric_t pkt_remote_trace; - extern prometheus::simpleapi::counter_metric_t pkt_path_negotiation_request; + + // incoming packets + extern prometheus::simpleapi::counter_metric_t pkt_error_in; + extern prometheus::simpleapi::counter_metric_t pkt_ack_in; + extern prometheus::simpleapi::counter_metric_t pkt_qos_in; + extern prometheus::simpleapi::counter_metric_t pkt_hello_in; + extern prometheus::simpleapi::counter_metric_t pkt_ok_in; + extern prometheus::simpleapi::counter_metric_t pkt_whois_in; + extern prometheus::simpleapi::counter_metric_t pkt_rendezvous_in; + extern prometheus::simpleapi::counter_metric_t pkt_frame_in; + extern prometheus::simpleapi::counter_metric_t pkt_ext_frame_in; + extern prometheus::simpleapi::counter_metric_t pkt_echo_in; + extern prometheus::simpleapi::counter_metric_t pkt_multicast_like_in; + extern prometheus::simpleapi::counter_metric_t pkt_network_credentials_in; + extern prometheus::simpleapi::counter_metric_t pkt_network_config_request_in; + extern prometheus::simpleapi::counter_metric_t pkt_network_config_in; + extern prometheus::simpleapi::counter_metric_t pkt_multicast_gather_in; + extern prometheus::simpleapi::counter_metric_t pkt_multicast_frame_in; + extern prometheus::simpleapi::counter_metric_t pkt_push_direct_paths_in; + extern prometheus::simpleapi::counter_metric_t pkt_user_message_in; + extern prometheus::simpleapi::counter_metric_t pkt_remote_trace_in; + extern prometheus::simpleapi::counter_metric_t pkt_path_negotiation_request_in; + + // outgoing packets + extern prometheus::simpleapi::counter_metric_t pkt_error_out; + extern prometheus::simpleapi::counter_metric_t pkt_ack_out; + extern prometheus::simpleapi::counter_metric_t pkt_qos_out; + extern prometheus::simpleapi::counter_metric_t pkt_hello_out; + extern prometheus::simpleapi::counter_metric_t pkt_ok_out; + extern prometheus::simpleapi::counter_metric_t pkt_whois_out; + extern prometheus::simpleapi::counter_metric_t pkt_rendezvous_out; + extern prometheus::simpleapi::counter_metric_t pkt_frame_out; + extern prometheus::simpleapi::counter_metric_t pkt_ext_frame_out; + extern prometheus::simpleapi::counter_metric_t pkt_echo_out; + extern prometheus::simpleapi::counter_metric_t pkt_multicast_like_out; + extern prometheus::simpleapi::counter_metric_t pkt_network_credentials_out; + extern prometheus::simpleapi::counter_metric_t pkt_network_config_request_out; + extern prometheus::simpleapi::counter_metric_t pkt_network_config_out; + extern prometheus::simpleapi::counter_metric_t pkt_multicast_gather_out; + extern prometheus::simpleapi::counter_metric_t pkt_multicast_frame_out; + extern prometheus::simpleapi::counter_metric_t pkt_push_direct_paths_out; + extern prometheus::simpleapi::counter_metric_t pkt_user_message_out; + extern prometheus::simpleapi::counter_metric_t pkt_remote_trace_out; + extern prometheus::simpleapi::counter_metric_t pkt_path_negotiation_request_out; // Packet Error Counts extern prometheus::simpleapi::counter_family_t packet_errors; - extern prometheus::simpleapi::counter_metric_t pkt_error_obj_not_found; - extern prometheus::simpleapi::counter_metric_t pkt_error_unsupported_op; - extern prometheus::simpleapi::counter_metric_t pkt_error_identity_collision; - extern prometheus::simpleapi::counter_metric_t pkt_error_need_membership_cert; - extern prometheus::simpleapi::counter_metric_t pkt_error_network_access_denied; - extern prometheus::simpleapi::counter_metric_t pkt_error_unwanted_multicast; - extern prometheus::simpleapi::counter_metric_t pkt_error_authentication_required; + + // incoming errors + extern prometheus::simpleapi::counter_metric_t pkt_error_obj_not_found_in; + extern prometheus::simpleapi::counter_metric_t pkt_error_unsupported_op_in; + extern prometheus::simpleapi::counter_metric_t pkt_error_identity_collision_in; + extern prometheus::simpleapi::counter_metric_t pkt_error_need_membership_cert_in; + extern prometheus::simpleapi::counter_metric_t pkt_error_network_access_denied_in; + extern prometheus::simpleapi::counter_metric_t pkt_error_unwanted_multicast_in; + extern prometheus::simpleapi::counter_metric_t pkt_error_authentication_required_in; + + // outgoing errors + extern prometheus::simpleapi::counter_metric_t pkt_error_obj_not_found_out; + extern prometheus::simpleapi::counter_metric_t pkt_error_unsupported_op_out; + extern prometheus::simpleapi::counter_metric_t pkt_error_identity_collision_out; + extern prometheus::simpleapi::counter_metric_t pkt_error_need_membership_cert_out; + extern prometheus::simpleapi::counter_metric_t pkt_error_network_access_denied_out; + extern prometheus::simpleapi::counter_metric_t pkt_error_unwanted_multicast_out; + extern prometheus::simpleapi::counter_metric_t pkt_error_authentication_required_out; // Data Sent/Received Metrics