From 6ea0aa73e4ab40259d843b41adeea43b1a78379b Mon Sep 17 00:00:00 2001 From: Johannes 'fish' Ziemke Date: Wed, 6 Feb 2019 20:02:48 +0100 Subject: [PATCH] Rename interface to device in netclass collector (#1224) * Rename interface to device in netclass collector This makes it consistent with other networking metrics like node_network_receive_bytes_total This closes #1223 Signed-off-by: Johannes 'fish' Ziemke --- CHANGELOG.md | 5 +++- collector/fixtures/e2e-output.txt | 38 +++++++++++++++---------------- collector/netclass_linux.go | 6 ++--- 3 files changed, 26 insertions(+), 23 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index b3c464d..7d95bc2 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,11 +2,14 @@ ### **Breaking changes** -The cpufreq metrics now separate the `cpufreq` and `scaling` data based on what the driver provides. #1248 +* Renamed `interface` label to `device` in netclass collector for consistency with + other network metrics #1224 +* The cpufreq metrics now separate the `cpufreq` and `scaling` data based on what the driver provides. #1248 ### Changes * [BUGFIX] +* [CHANGE] Renamed `interface` label to `device` in netclass collector #1224 * [BUGFIX] Add fallback for missing /proc/1/mounts #1172 * [CHANGE] Add TCPSynRetrans to netstat default filter #1143 * [CHANGE] Add a limit to the number of in-flight requests #1166 diff --git a/collector/fixtures/e2e-output.txt b/collector/fixtures/e2e-output.txt index ba11e23..2f9e097 100644 --- a/collector/fixtures/e2e-output.txt +++ b/collector/fixtures/e2e-output.txt @@ -1804,49 +1804,49 @@ node_netstat_Udp_NoPorts 120 node_netstat_Udp_OutDatagrams 53028 # HELP node_network_address_assign_type address_assign_type value of /sys/class/net/. # TYPE node_network_address_assign_type gauge -node_network_address_assign_type{interface="eth0"} 3 +node_network_address_assign_type{device="eth0"} 3 # HELP node_network_carrier carrier value of /sys/class/net/. # TYPE node_network_carrier gauge -node_network_carrier{interface="eth0"} 1 +node_network_carrier{device="eth0"} 1 # HELP node_network_carrier_changes_total carrier_changes_total value of /sys/class/net/. # TYPE node_network_carrier_changes_total counter -node_network_carrier_changes_total{interface="eth0"} 2 +node_network_carrier_changes_total{device="eth0"} 2 # HELP node_network_carrier_down_changes_total carrier_down_changes_total value of /sys/class/net/. # TYPE node_network_carrier_down_changes_total counter -node_network_carrier_down_changes_total{interface="eth0"} 1 +node_network_carrier_down_changes_total{device="eth0"} 1 # HELP node_network_carrier_up_changes_total carrier_up_changes_total value of /sys/class/net/. # TYPE node_network_carrier_up_changes_total counter -node_network_carrier_up_changes_total{interface="eth0"} 1 +node_network_carrier_up_changes_total{device="eth0"} 1 # HELP node_network_device_id device_id value of /sys/class/net/. # TYPE node_network_device_id gauge -node_network_device_id{interface="eth0"} 32 +node_network_device_id{device="eth0"} 32 # HELP node_network_dormant dormant value of /sys/class/net/. # TYPE node_network_dormant gauge -node_network_dormant{interface="eth0"} 1 +node_network_dormant{device="eth0"} 1 # HELP node_network_flags flags value of /sys/class/net/. # TYPE node_network_flags gauge -node_network_flags{interface="eth0"} 4867 +node_network_flags{device="eth0"} 4867 # HELP node_network_iface_id iface_id value of /sys/class/net/. # TYPE node_network_iface_id gauge -node_network_iface_id{interface="eth0"} 2 +node_network_iface_id{device="eth0"} 2 # HELP node_network_iface_link iface_link value of /sys/class/net/. # TYPE node_network_iface_link gauge -node_network_iface_link{interface="eth0"} 2 +node_network_iface_link{device="eth0"} 2 # HELP node_network_iface_link_mode iface_link_mode value of /sys/class/net/. # TYPE node_network_iface_link_mode gauge -node_network_iface_link_mode{interface="eth0"} 1 +node_network_iface_link_mode{device="eth0"} 1 # HELP node_network_mtu_bytes mtu_bytes value of /sys/class/net/. # TYPE node_network_mtu_bytes gauge -node_network_mtu_bytes{interface="eth0"} 1500 +node_network_mtu_bytes{device="eth0"} 1500 # HELP node_network_name_assign_type name_assign_type value of /sys/class/net/. # TYPE node_network_name_assign_type gauge -node_network_name_assign_type{interface="eth0"} 2 +node_network_name_assign_type{device="eth0"} 2 # HELP node_network_net_dev_group net_dev_group value of /sys/class/net/. # TYPE node_network_net_dev_group gauge -node_network_net_dev_group{interface="eth0"} 0 +node_network_net_dev_group{device="eth0"} 0 # HELP node_network_protocol_type protocol_type value of /sys/class/net/. # TYPE node_network_protocol_type gauge -node_network_protocol_type{interface="eth0"} 1 +node_network_protocol_type{device="eth0"} 1 # HELP node_network_receive_bytes_total Network device statistic receive_bytes. # TYPE node_network_receive_bytes_total counter node_network_receive_bytes_total{device="docker0"} 6.4910168e+07 @@ -1945,7 +1945,7 @@ node_network_receive_packets_total{device="wlan0"} 1.3899359e+07 node_network_receive_packets_total{device="💩0"} 105557 # HELP node_network_speed_bytes speed_bytes value of /sys/class/net/. # TYPE node_network_speed_bytes gauge -node_network_speed_bytes{interface="eth0"} 1.25e+08 +node_network_speed_bytes{device="eth0"} 1.25e+08 # HELP node_network_transmit_bytes_total Network device statistic transmit_bytes. # TYPE node_network_transmit_bytes_total counter node_network_transmit_bytes_total{device="docker0"} 2.681662018e+09 @@ -2044,10 +2044,10 @@ node_network_transmit_packets_total{device="wlan0"} 1.17262e+07 node_network_transmit_packets_total{device="💩0"} 304261 # HELP node_network_transmit_queue_length transmit_queue_length value of /sys/class/net/. # TYPE node_network_transmit_queue_length gauge -node_network_transmit_queue_length{interface="eth0"} 1000 -# HELP node_network_up Valid operstate for interface. +node_network_transmit_queue_length{device="eth0"} 1000 +# HELP node_network_up Valid operstate for device. # TYPE node_network_up gauge -node_network_up{address="01:01:01:01:01:01",broadcast="ff:ff:ff:ff:ff:ff",duplex="full",ifalias="",interface="eth0",operstate="up"} 1 +node_network_up{address="01:01:01:01:01:01",broadcast="ff:ff:ff:ff:ff:ff",device="eth0",duplex="full",ifalias="",operstate="up"} 1 # HELP node_nf_conntrack_entries Number of currently allocated flow entries for connection tracking. # TYPE node_nf_conntrack_entries gauge node_nf_conntrack_entries 123 diff --git a/collector/netclass_linux.go b/collector/netclass_linux.go index a71f302..fffbd84 100644 --- a/collector/netclass_linux.go +++ b/collector/netclass_linux.go @@ -57,8 +57,8 @@ func (c *netClassCollector) Update(ch chan<- prometheus.Metric) error { for _, ifaceInfo := range netClass { upDesc := prometheus.NewDesc( prometheus.BuildFQName(namespace, c.subsystem, "up"), - "Valid operstate for interface.", - []string{"interface", "address", "broadcast", "duplex", "operstate", "ifalias"}, + "Valid operstate for device.", + []string{"device", "address", "broadcast", "duplex", "operstate", "ifalias"}, nil, ) upValue := 0.0 @@ -145,7 +145,7 @@ func pushMetric(ch chan<- prometheus.Metric, subsystem string, name string, valu fieldDesc := prometheus.NewDesc( prometheus.BuildFQName(namespace, subsystem, name), fmt.Sprintf("%s value of /sys/class/net/.", name), - []string{"interface"}, + []string{"device"}, nil, )