From 96ab0bab43c4113d5d6c2c27f1a75fa63a69d2bc Mon Sep 17 00:00:00 2001 From: Grant Limberg Date: Thu, 4 May 2023 08:27:36 -0700 Subject: [PATCH] Further collapse tcp & udp into metric labels for zt_data --- node/Metrics.cpp | 14 ++++++-------- node/Metrics.hpp | 3 +-- 2 files changed, 7 insertions(+), 10 deletions(-) diff --git a/node/Metrics.cpp b/node/Metrics.cpp index 1f80bd37f..afcef4514 100644 --- a/node/Metrics.cpp +++ b/node/Metrics.cpp @@ -157,18 +157,16 @@ namespace ZeroTier { { packet_errors.Add({{"error_type", "internal_server_error"}, {"direction", "tx"}}) }; // Data Sent/Received Metrics - prometheus::simpleapi::counter_family_t udp - { "zt_udp_data", "number of bytes ZeroTier has transmitted or received via UDP" }; + prometheus::simpleapi::counter_family_t data + { "zt_data", "number of bytes ZeroTier has transmitted or received via UDP" }; prometheus::simpleapi::counter_metric_t udp_recv - { udp.Add({{"direction","rx"}}) }; + { data.Add({{"protocol","udp"},{"direction","rx"}}) }; prometheus::simpleapi::counter_metric_t udp_send - { udp.Add({{"direction","tx"}}) }; - prometheus::simpleapi::counter_family_t tcp - { "zt_tcp_data", "number of bytes ZeroTier has transmitted or received via TCP" }; + { data.Add({{"protocol","udp"},{"direction","tx"}}) }; prometheus::simpleapi::counter_metric_t tcp_send - { tcp.Add({{"direction", "tx"}}) }; + { data.Add({{"protocol","tcp"},{"direction", "tx"}}) }; prometheus::simpleapi::counter_metric_t tcp_recv - { tcp.Add({{"direction", "rx"}}) }; + { data.Add({{"protocol","tcp"},{"direction", "rx"}}) }; // Network Metrics prometheus::simpleapi::gauge_metric_t network_num_joined diff --git a/node/Metrics.hpp b/node/Metrics.hpp index f95e37a7d..3765e890f 100644 --- a/node/Metrics.hpp +++ b/node/Metrics.hpp @@ -96,10 +96,9 @@ namespace ZeroTier { extern prometheus::simpleapi::counter_metric_t pkt_error_internal_server_error_out; // Data Sent/Received Metrics - extern prometheus::simpleapi::counter_family_t udp; + extern prometheus::simpleapi::counter_family_t data; extern prometheus::simpleapi::counter_metric_t udp_send; extern prometheus::simpleapi::counter_metric_t udp_recv; - extern prometheus::simpleapi::counter_family_t tcp; extern prometheus::simpleapi::counter_metric_t tcp_send; extern prometheus::simpleapi::counter_metric_t tcp_recv;