Skip to content

Add collector for SR-IOV network Virtual Function statistics#3544

Open
aharivel wants to merge 2 commits intoprometheus:masterfrom
aharivel:sriov
Open

Add collector for SR-IOV network Virtual Function statistics#3544
aharivel wants to merge 2 commits intoprometheus:masterfrom
aharivel:sriov

Conversation

@aharivel
Copy link

@aharivel aharivel commented Feb 9, 2026

  1. Bump github.com/jsimonetti/rtnetlink/v2 from 2.1.0 to 2.2.0 - this add the VF stats used for the next commit.

  2. Add a new netvf collector that exposes SR-IOV network VF statistics and configuration via rtnetlink. The collector queries netlink for interfaces with Virtual Functions and exposes per-VF metrics:

    • node_net_vf_info: VF configuration (MAC, VLAN, link state, spoof
      check, trust, PCI address)
    • node_net_vf_{receive,transmit}_{packets,bytes}_total: traffic counters
    • node_net_vf_{broadcast,multicast}_packets_total: packet type counters
    • node_net_vf_{receive,transmit}_dropped_total: drop counters

All metrics include a pci_address label resolved from the sysfs virtfn symlink, enabling direct correlation with workloads that reference VFs by PCI BDF address (e.g. OpenStack Nova, libvirt, DPDK).

The collector is disabled by default and can be enabled with
--collector.netvf. PF device filtering is supported via
--collector.netvf.device-include/exclude flags.

Tested on MT2894 Family [ConnectX-6 Lx] and Ethernet Controller E810-XXV with VFs bound to both kernel driver and vfio-pci driver (for direct assignment to Virtual Machines).

# curl -s 0.0.0.0:9100/metrics | grep node_net_vf                     
# HELP node_net_vf_broadcast_packets_total Number of broadcast packets received by the VF.    
# TYPE node_net_vf_broadcast_packets_total counter                                                                        
node_net_vf_broadcast_packets_total{device="eno12399np0",pci_address="0000:8a:01.0",vf="0"} 2854
node_net_vf_broadcast_packets_total{device="eno12399np0",pci_address="0000:8a:01.1",vf="1"} 5787                          
node_net_vf_broadcast_packets_total{device="eno12399np0",pci_address="0000:8a:01.2",vf="2"} 5787
node_net_vf_broadcast_packets_total{device="enp24s0f0np0",pci_address="0000:18:00.2",vf="0"} 5787                         
node_net_vf_broadcast_packets_total{device="enp24s0f0np0",pci_address="0000:18:00.3",vf="1"} 5785
node_net_vf_broadcast_packets_total{device="enp24s0f0np0",pci_address="0000:18:00.4",vf="2"} 0                            
# HELP node_net_vf_info Virtual Function configuration information.
# TYPE node_net_vf_info gauge                                                                                             
node_net_vf_info{device="eno12399np0",link_state="auto",mac="52:54:00:5b:ed:fb",pci_address="0000:8a:01.0",spoof_check="tr
ue",trust="false",vf="0",vlan="0"} 1                                                                                      
node_net_vf_info{device="eno12399np0",link_state="auto",mac="aa:33:1d:fe:b2:a2",pci_address="0000:8a:01.1",spoof_check="tr
ue",trust="false",vf="1",vlan="0"} 1                                                                                      
node_net_vf_info{device="eno12399np0",link_state="auto",mac="ce:90:a4:a8:b3:8c",pci_address="0000:8a:01.2",spoof_check="tr
ue",trust="false",vf="2",vlan="0"} 1                                                                                      
node_net_vf_info{device="enp24s0f0np0",link_state="auto",mac="00:00:00:00:00:00",pci_address="0000:18:00.2",spoof_check="f
alse",trust="false",vf="0",vlan="0"} 1                                                                                    
node_net_vf_info{device="enp24s0f0np0",link_state="auto",mac="00:00:00:00:00:00",pci_address="0000:18:00.4",spoof_check="f
alse",trust="false",vf="2",vlan="0"} 1                                                                                    
node_net_vf_info{device="enp24s0f0np0",link_state="auto",mac="52:54:00:e0:16:91",pci_address="0000:18:00.3",spoof_check="f
alse",trust="false",vf="1",vlan="0"} 1                                                                                    
# HELP node_net_vf_multicast_packets_total Number of multicast packets received by the VF.    
# TYPE node_net_vf_multicast_packets_total counter                                                                        
node_net_vf_multicast_packets_total{device="eno12399np0",pci_address="0000:8a:01.0",vf="0"} 0
node_net_vf_multicast_packets_total{device="eno12399np0",pci_address="0000:8a:01.1",vf="1"} 0 
node_net_vf_multicast_packets_total{device="eno12399np0",pci_address="0000:8a:01.2",vf="2"} 0       
node_net_vf_multicast_packets_total{device="enp24s0f0np0",pci_address="0000:18:00.2",vf="0"} 0      
node_net_vf_multicast_packets_total{device="enp24s0f0np0",pci_address="0000:18:00.3",vf="1"} 573     
node_net_vf_multicast_packets_total{device="enp24s0f0np0",pci_address="0000:18:00.4",vf="2"} 0      
# HELP node_net_vf_receive_bytes_total Number of received bytes by the VF.                
# TYPE node_net_vf_receive_bytes_total counter                                                                            
node_net_vf_receive_bytes_total{device="eno12399np0",pci_address="0000:8a:01.0",vf="0"} 936112
node_net_vf_receive_bytes_total{device="eno12399np0",pci_address="0000:8a:01.1",vf="1"} 1.886564e+06
node_net_vf_receive_bytes_total{device="eno12399np0",pci_address="0000:8a:01.2",vf="2"} 1.886564e+06
node_net_vf_receive_bytes_total{device="enp24s0f0np0",pci_address="0000:18:00.2",vf="0"} 1.898136e+06
node_net_vf_receive_bytes_total{device="enp24s0f0np0",pci_address="0000:18:00.3",vf="1"} 1.94905e+06
node_net_vf_receive_bytes_total{device="enp24s0f0np0",pci_address="0000:18:00.4",vf="2"} 0  
# HELP node_net_vf_receive_dropped_total Number of dropped received packets by the VF.      
# TYPE node_net_vf_receive_dropped_total counter                                                                          
node_net_vf_receive_dropped_total{device="eno12399np0",pci_address="0000:8a:01.0",vf="0"} 0
node_net_vf_receive_dropped_total{device="eno12399np0",pci_address="0000:8a:01.1",vf="1"} 5787
node_net_vf_receive_dropped_total{device="eno12399np0",pci_address="0000:8a:01.2",vf="2"} 5787
node_net_vf_receive_dropped_total{device="enp24s0f0np0",pci_address="0000:18:00.2",vf="0"} 0  
node_net_vf_receive_dropped_total{device="enp24s0f0np0",pci_address="0000:18:00.3",vf="1"} 0   
node_net_vf_receive_dropped_total{device="enp24s0f0np0",pci_address="0000:18:00.4",vf="2"} 0   
# HELP node_net_vf_receive_packets_total Number of received packets by the VF.              
# TYPE node_net_vf_receive_packets_total counter                                                                          
node_net_vf_receive_packets_total{device="eno12399np0",pci_address="0000:8a:01.0",vf="0"} 2854
node_net_vf_receive_packets_total{device="eno12399np0",pci_address="0000:8a:01.1",vf="1"} 5787       
node_net_vf_receive_packets_total{device="eno12399np0",pci_address="0000:8a:01.2",vf="2"} 5787
node_net_vf_receive_packets_total{device="enp24s0f0np0",pci_address="0000:18:00.2",vf="0"} 5787
node_net_vf_receive_packets_total{device="enp24s0f0np0",pci_address="0000:18:00.3",vf="1"} 6358
node_net_vf_receive_packets_total{device="enp24s0f0np0",pci_address="0000:18:00.4",vf="2"} 0         
# HELP node_net_vf_transmit_bytes_total Number of transmitted bytes by the VF.             
# TYPE node_net_vf_transmit_bytes_total counter                                                                           
node_net_vf_transmit_bytes_total{device="eno12399np0",pci_address="0000:8a:01.0",vf="0"} 1.320584e+06
node_net_vf_transmit_bytes_total{device="eno12399np0",pci_address="0000:8a:01.1",vf="1"} 0  
node_net_vf_transmit_bytes_total{device="eno12399np0",pci_address="0000:8a:01.2",vf="2"} 0  
node_net_vf_transmit_bytes_total{device="enp24s0f0np0",pci_address="0000:18:00.2",vf="0"} 0 
node_net_vf_transmit_bytes_total{device="enp24s0f0np0",pci_address="0000:18:00.3",vf="1"} 1.33942e+06
node_net_vf_transmit_bytes_total{device="enp24s0f0np0",pci_address="0000:18:00.4",vf="2"} 0  
# HELP node_net_vf_transmit_dropped_total Number of dropped transmitted packets by the VF.   
# TYPE node_net_vf_transmit_dropped_total counter                                                                         
node_net_vf_transmit_dropped_total{device="eno12399np0",pci_address="0000:8a:01.0",vf="0"} 0
node_net_vf_transmit_dropped_total{device="eno12399np0",pci_address="0000:8a:01.1",vf="1"} 0   
node_net_vf_transmit_dropped_total{device="eno12399np0",pci_address="0000:8a:01.2",vf="2"} 0
node_net_vf_transmit_dropped_total{device="enp24s0f0np0",pci_address="0000:18:00.2",vf="0"} 0
node_net_vf_transmit_dropped_total{device="enp24s0f0np0",pci_address="0000:18:00.3",vf="1"} 0
node_net_vf_transmit_dropped_total{device="enp24s0f0np0",pci_address="0000:18:00.4",vf="2"} 0   
# HELP node_net_vf_transmit_packets_total Number of transmitted packets by the VF.           
# TYPE node_net_vf_transmit_packets_total counter`
node_net_vf_transmit_packets_total{device="eno12399np0",pci_address="0000:8a:01.0",vf="0"} 7991
node_net_vf_transmit_packets_total{device="eno12399np0",pci_address="0000:8a:01.1",vf="1"} 0
node_net_vf_transmit_packets_total{device="eno12399np0",pci_address="0000:8a:01.2",vf="2"} 0
node_net_vf_transmit_packets_total{device="enp24s0f0np0",pci_address="0000:18:00.2",vf="0"} 0
node_net_vf_transmit_packets_total{device="enp24s0f0np0",pci_address="0000:18:00.3",vf="1"} 8104
node_net_vf_transmit_packets_total{device="enp24s0f0np0",pci_address="0000:18:00.4",vf="2"} 0

Bumps [github.com/jsimonetti/rtnetlink/v2](https://github.com/jsimonetti/rtnetlink) from 2.1.0 to 2.2.0.

Signed-off-by: Anthony Harivel <aharivel@redhat.com>
@aharivel aharivel marked this pull request as draft February 9, 2026 16:30
@aharivel aharivel force-pushed the sriov branch 2 times, most recently from de8cfff to b5ea870 Compare February 10, 2026 10:29
Add a new netvf collector that exposes SR-IOV network VF statistics and
configuration via rtnetlink. The collector queries netlink for
interfaces with Virtual Functions and exposes per-VF metrics:

- node_net_vf_info: VF configuration (MAC, VLAN, link state, spoof
  check, trust, PCI address)
- node_net_vf_{receive,transmit}_{packets,bytes}_total: traffic counters
- node_net_vf_{broadcast,multicast}_packets_total: packet type counters
- node_net_vf_{receive,transmit}_dropped_total: drop counters

All metrics include a pci_address label resolved from the sysfs virtfn
symlink, enabling direct correlation with workloads that reference VFs
by PCI BDF address (e.g. OpenStack Nova, libvirt, DPDK).

The collector is disabled by default and can be enabled with
--collector.netvf. PF device filtering is supported via
--collector.netvf.device-include/exclude flags.

Signed-off-by: Anthony Harivel <aharivel@redhat.com>
@aharivel aharivel changed the title Add collector for SR-IOV Virtual Function statistics Add collector for SR-IOV network Virtual Function statistics Feb 10, 2026
@aharivel aharivel marked this pull request as ready for review February 10, 2026 10:46
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant