diff --git a/collector/hyperv.go b/collector/hyperv.go index c4281471..4fb99dc2 100644 --- a/collector/hyperv.go +++ b/collector/hyperv.go @@ -90,15 +90,16 @@ type HyperVCollector struct { // NewHyperVCollector ... func NewHyperVCollector() (Collector, error) { + buildSubsystemName := func(component string) string { return "hyperv_" + component } return &HyperVCollector{ HealthCritical: prometheus.NewDesc( - prometheus.BuildFQName(Namespace, "health", "health_critical"), + prometheus.BuildFQName(Namespace, buildSubsystemName("health"), "critical"), "This counter represents the number of virtual machines with critical health", nil, nil, ), HealthOk: prometheus.NewDesc( - prometheus.BuildFQName(Namespace, "health", "health_ok"), + prometheus.BuildFQName(Namespace, buildSubsystemName("health"), "ok"), "This counter represents the number of virtual machines with ok health", nil, nil, @@ -107,19 +108,19 @@ func NewHyperVCollector() (Collector, error) { // PhysicalPagesAllocated: prometheus.NewDesc( - prometheus.BuildFQName(Namespace, "vid", "physical_pages_allocated"), + prometheus.BuildFQName(Namespace, buildSubsystemName("vid"), "physical_pages_allocated"), "The number of physical pages allocated", nil, nil, ), PreferredNUMANodeIndex: prometheus.NewDesc( - prometheus.BuildFQName(Namespace, "vid", "preferred_numa_node_index"), + prometheus.BuildFQName(Namespace, buildSubsystemName("vid"), "preferred_numa_node_index"), "The preferred NUMA node index associated with this partition", nil, nil, ), RemotePhysicalPages: prometheus.NewDesc( - prometheus.BuildFQName(Namespace, "vid", "remote_physical_pages"), + prometheus.BuildFQName(Namespace, buildSubsystemName("vid"), "remote_physical_pages"), "The number of physical pages not allocated from the preferred NUMA node", nil, nil, @@ -128,127 +129,127 @@ func NewHyperVCollector() (Collector, error) { // AddressSpaces: prometheus.NewDesc( - prometheus.BuildFQName(Namespace, "hv", "address_spaces"), + prometheus.BuildFQName(Namespace, buildSubsystemName("root_partition"), "address_spaces"), "The number of address spaces in the virtual TLB of the partition", nil, nil, ), AttachedDevices: prometheus.NewDesc( - prometheus.BuildFQName(Namespace, "hv", "attached_devices"), + prometheus.BuildFQName(Namespace, buildSubsystemName("root_partition"), "attached_devices"), "The number of devices attached to the partition", nil, nil, ), DepositedPages: prometheus.NewDesc( - prometheus.BuildFQName(Namespace, "hv", "deposited_pages"), + prometheus.BuildFQName(Namespace, buildSubsystemName("root_partition"), "deposited_pages"), "The number of pages deposited into the partition", nil, nil, ), DeviceDMAErrors: prometheus.NewDesc( - prometheus.BuildFQName(Namespace, "hv", "device_dma_errors"), + prometheus.BuildFQName(Namespace, buildSubsystemName("root_partition"), "device_dma_errors"), "An indicator of illegal DMA requests generated by all devices assigned to the partition", nil, nil, ), DeviceInterruptErrors: prometheus.NewDesc( - prometheus.BuildFQName(Namespace, "hv", "device_interrupt_errors"), + prometheus.BuildFQName(Namespace, buildSubsystemName("root_partition"), "device_interrupt_errors"), "An indicator of illegal interrupt requests generated by all devices assigned to the partition", nil, nil, ), DeviceInterruptMappings: prometheus.NewDesc( - prometheus.BuildFQName(Namespace, "hv", "device_interrupt_mappings"), + prometheus.BuildFQName(Namespace, buildSubsystemName("root_partition"), "device_interrupt_mappings"), "The number of device interrupt mappings used by the partition", nil, nil, ), DeviceInterruptThrottleEvents: prometheus.NewDesc( - prometheus.BuildFQName(Namespace, "hv", "device_interrupt_throttle_events"), + prometheus.BuildFQName(Namespace, buildSubsystemName("root_partition"), "device_interrupt_throttle_events"), "The number of times an interrupt from a device assigned to the partition was temporarily throttled because the device was generating too many interrupts", nil, nil, ), GPAPages: prometheus.NewDesc( - prometheus.BuildFQName(Namespace, "hv", "preferred_numa_node_index"), + prometheus.BuildFQName(Namespace, buildSubsystemName("root_partition"), "preferred_numa_node_index"), "The number of pages present in the GPA space of the partition (zero for root partition)", nil, nil, ), GPASpaceModifications: prometheus.NewDesc( - prometheus.BuildFQName(Namespace, "hv", "gpa_space_modifications"), + prometheus.BuildFQName(Namespace, buildSubsystemName("root_partition"), "gpa_space_modifications"), "The rate of modifications to the GPA space of the partition", nil, nil, ), IOTLBFlushCost: prometheus.NewDesc( - prometheus.BuildFQName(Namespace, "hv", "io_tlb_flush_cost"), + prometheus.BuildFQName(Namespace, buildSubsystemName("root_partition"), "io_tlb_flush_cost"), "The average time (in nanoseconds) spent processing an I/O TLB flush", nil, nil, ), IOTLBFlushes: prometheus.NewDesc( - prometheus.BuildFQName(Namespace, "hv", "io_tlb_flush"), + prometheus.BuildFQName(Namespace, buildSubsystemName("root_partition"), "io_tlb_flush"), "The rate of flushes of I/O TLBs of the partition", nil, nil, ), RecommendedVirtualTLBSize: prometheus.NewDesc( - prometheus.BuildFQName(Namespace, "hv", "recommended_virtual_tlb_size"), + prometheus.BuildFQName(Namespace, buildSubsystemName("root_partition"), "recommended_virtual_tlb_size"), "The recommended number of pages to be deposited for the virtual TLB", nil, nil, ), SkippedTimerTicks: prometheus.NewDesc( - prometheus.BuildFQName(Namespace, "hv", "physical_pages_allocated"), + prometheus.BuildFQName(Namespace, buildSubsystemName("root_partition"), "physical_pages_allocated"), "The number of timer interrupts skipped for the partition", nil, nil, ), Value1Gdevicepages: prometheus.NewDesc( - prometheus.BuildFQName(Namespace, "hv", "1G_device_pages"), + prometheus.BuildFQName(Namespace, buildSubsystemName("root_partition"), "1G_device_pages"), "The number of 1G pages present in the device space of the partition", nil, nil, ), Value1GGPApages: prometheus.NewDesc( - prometheus.BuildFQName(Namespace, "hv", "1G_gpa_pages"), + prometheus.BuildFQName(Namespace, buildSubsystemName("root_partition"), "1G_gpa_pages"), "The number of 1G pages present in the GPA space of the partition", nil, nil, ), Value2Mdevicepages: prometheus.NewDesc( - prometheus.BuildFQName(Namespace, "hv", "2M_device_pages"), + prometheus.BuildFQName(Namespace, buildSubsystemName("root_partition"), "2M_device_pages"), "The number of 2M pages present in the device space of the partition", nil, nil, ), Value2MGPApages: prometheus.NewDesc( - prometheus.BuildFQName(Namespace, "hv", "2M_gpa_pages"), + prometheus.BuildFQName(Namespace, buildSubsystemName("root_partition"), "2M_gpa_pages"), "The number of 2M pages present in the GPA space of the partition", nil, nil, ), Value4Kdevicepages: prometheus.NewDesc( - prometheus.BuildFQName(Namespace, "hv", "4K_device_pages"), + prometheus.BuildFQName(Namespace, buildSubsystemName("root_partition"), "4K_device_pages"), "The number of 4K pages present in the device space of the partition", nil, nil, ), Value4KGPApages: prometheus.NewDesc( - prometheus.BuildFQName(Namespace, "hv", "4K_gpa_pages"), + prometheus.BuildFQName(Namespace, buildSubsystemName("root_partition"), "4K_gpa_pages"), "The number of 4K pages present in the GPA space of the partition", nil, nil, ), VirtualTLBFlushEntires: prometheus.NewDesc( - prometheus.BuildFQName(Namespace, "hv", "virtual_tlb_flush_entires"), + prometheus.BuildFQName(Namespace, buildSubsystemName("root_partition"), "virtual_tlb_flush_entires"), "The rate of flushes of the entire virtual TLB", nil, nil, ), VirtualTLBPages: prometheus.NewDesc( - prometheus.BuildFQName(Namespace, "hv", "virtual_tlb_pages"), + prometheus.BuildFQName(Namespace, buildSubsystemName("root_partition"), "virtual_tlb_pages"), "The number of pages used by the virtual TLB of the partition", nil, nil, @@ -257,13 +258,13 @@ func NewHyperVCollector() (Collector, error) { // VirtualProcessors: prometheus.NewDesc( - prometheus.BuildFQName(Namespace, "processor", "virtual_processors"), + prometheus.BuildFQName(Namespace, buildSubsystemName("hypervisor"), "virtual_processors"), "The number of virtual processors present in the system", nil, nil, ), LogicalProcessors: prometheus.NewDesc( - prometheus.BuildFQName(Namespace, "processor", "logical_processors"), + prometheus.BuildFQName(Namespace, buildSubsystemName("hypervisor"), "logical_processors"), "The number of logical processors present in the system", nil, nil, @@ -272,153 +273,153 @@ func NewHyperVCollector() (Collector, error) { // PercentGuestRunTime: prometheus.NewDesc( - prometheus.BuildFQName(Namespace, "rate", "guest_run_time"), - "The percentage of time spent by the virtual processor in guest code", + prometheus.BuildFQName(Namespace, buildSubsystemName("vcpu"), "guest_run_time"), + "The time spent by the virtual processor in guest code", []string{"core"}, nil, ), PercentHypervisorRunTime: prometheus.NewDesc( - prometheus.BuildFQName(Namespace, "rate", "hypervisor_run_time"), - "The percentage of time spent by the virtual processor in hypervisor code", + prometheus.BuildFQName(Namespace, buildSubsystemName("vcpu"), "hypervisor_run_time"), + "The time spent by the virtual processor in hypervisor code", []string{"core"}, nil, ), PercentRemoteRunTime: prometheus.NewDesc( - prometheus.BuildFQName(Namespace, "rate", "remote_run_time"), - "The percentage of time spent by the virtual processor running on a remote node", + prometheus.BuildFQName(Namespace, buildSubsystemName("vcpu"), "remote_run_time"), + "The time spent by the virtual processor running on a remote node", []string{"core"}, nil, ), PercentTotalRunTime: prometheus.NewDesc( - prometheus.BuildFQName(Namespace, "rate", "total_run_time"), - "The percentage of time spent by the virtual processor in guest and hypervisor code", + prometheus.BuildFQName(Namespace, buildSubsystemName("vcpu"), "total_run_time"), + "The time spent by the virtual processor in guest and hypervisor code", []string{"core"}, nil, ), // BroadcastPacketsReceived: prometheus.NewDesc( - prometheus.BuildFQName(Namespace, "switch", "broadcast_packets_received_total"), + prometheus.BuildFQName(Namespace, buildSubsystemName("vswitch"), "broadcast_packets_received_total"), "This represents the total number of broadcast packets received per second by the virtual switch", nil, nil, ), BroadcastPacketsSent: prometheus.NewDesc( - prometheus.BuildFQName(Namespace, "switch", "broadcast_packets_sent_total"), + prometheus.BuildFQName(Namespace, buildSubsystemName("vswitch"), "broadcast_packets_sent_total"), "This represents the total number of broadcast packets sent per second by the virtual switch", nil, nil, ), Bytes: prometheus.NewDesc( - prometheus.BuildFQName(Namespace, "switch", "bytes_total"), + prometheus.BuildFQName(Namespace, buildSubsystemName("vswitch"), "bytes_total"), "This represents the total number of bytes per second traversing the virtual switch", nil, nil, ), BytesReceived: prometheus.NewDesc( - prometheus.BuildFQName(Namespace, "switch", "bytes_received_total"), + prometheus.BuildFQName(Namespace, buildSubsystemName("vswitch"), "bytes_received_total"), "This represents the total number of bytes received per second by the virtual switch", nil, nil, ), BytesSent: prometheus.NewDesc( - prometheus.BuildFQName(Namespace, "switch", "bytes_sent_total"), + prometheus.BuildFQName(Namespace, buildSubsystemName("vswitch"), "bytes_sent_total"), "This represents the total number of bytes sent per second by the virtual switch", nil, nil, ), DirectedPacketsReceived: prometheus.NewDesc( - prometheus.BuildFQName(Namespace, "switch", "directed_packets_received_total"), + prometheus.BuildFQName(Namespace, buildSubsystemName("vswitch"), "directed_packets_received_total"), "This represents the total number of directed packets received per second by the virtual switch", nil, nil, ), DirectedPacketsSent: prometheus.NewDesc( - prometheus.BuildFQName(Namespace, "switch", "directed_packets_send_total"), + prometheus.BuildFQName(Namespace, buildSubsystemName("vswitch"), "directed_packets_send_total"), "This represents the total number of directed packets sent per second by the virtual switch", nil, nil, ), DroppedPacketsIncoming: prometheus.NewDesc( - prometheus.BuildFQName(Namespace, "switch", "dropped_packets_incoming_total"), + prometheus.BuildFQName(Namespace, buildSubsystemName("vswitch"), "dropped_packets_incoming_total"), "This represents the total number of packet dropped per second by the virtual switch in the incoming direction", nil, nil, ), DroppedPacketsOutgoing: prometheus.NewDesc( - prometheus.BuildFQName(Namespace, "switch", "dropped_packets_outcoming_total"), + prometheus.BuildFQName(Namespace, buildSubsystemName("vswitch"), "dropped_packets_outcoming_total"), "This represents the total number of packet dropped per second by the virtual switch in the outgoing direction", nil, nil, ), ExtensionsDroppedPacketsIncoming: prometheus.NewDesc( - prometheus.BuildFQName(Namespace, "switch", "extensions_dropped_packets_incoming_total"), + prometheus.BuildFQName(Namespace, buildSubsystemName("vswitch"), "extensions_dropped_packets_incoming_total"), "This represents the total number of packet dropped per second by the virtual switch extensions in the incoming direction", nil, nil, ), ExtensionsDroppedPacketsOutgoing: prometheus.NewDesc( - prometheus.BuildFQName(Namespace, "switch", "extensions_dropped_packets_outcoming_total"), + prometheus.BuildFQName(Namespace, buildSubsystemName("vswitch"), "extensions_dropped_packets_outcoming_total"), "This represents the total number of packet dropped per second by the virtual switch extensions in the outgoing direction", nil, nil, ), LearnedMacAddresses: prometheus.NewDesc( - prometheus.BuildFQName(Namespace, "switch", "learned_mac_addresses_total"), + prometheus.BuildFQName(Namespace, buildSubsystemName("vswitch"), "learned_mac_addresses_total"), "This counter represents the total number of learned MAC addresses of the virtual switch", nil, nil, ), MulticastPacketsReceived: prometheus.NewDesc( - prometheus.BuildFQName(Namespace, "switch", "multicast_packets_received_total"), + prometheus.BuildFQName(Namespace, buildSubsystemName("vswitch"), "multicast_packets_received_total"), "This represents the total number of multicast packets received per second by the virtual switch", nil, nil, ), MulticastPacketsSent: prometheus.NewDesc( - prometheus.BuildFQName(Namespace, "switch", "multicast_packets_sent_total"), + prometheus.BuildFQName(Namespace, buildSubsystemName("vswitch"), "multicast_packets_sent_total"), "This represents the total number of multicast packets sent per second by the virtual switch", nil, nil, ), NumberofSendChannelMoves: prometheus.NewDesc( - prometheus.BuildFQName(Namespace, "switch", "number_of_send_channel_moves_total"), + prometheus.BuildFQName(Namespace, buildSubsystemName("vswitch"), "number_of_send_channel_moves_total"), "This represents the total number of send channel moves per second on this virtual switch", nil, nil, ), NumberofVMQMoves: prometheus.NewDesc( - prometheus.BuildFQName(Namespace, "switch", "number_of_vmq_moves_total"), + prometheus.BuildFQName(Namespace, buildSubsystemName("vswitch"), "number_of_vmq_moves_total"), "This represents the total number of VMQ moves per second on this virtual switch", nil, nil, ), PacketsFlooded: prometheus.NewDesc( - prometheus.BuildFQName(Namespace, "switch", "packets_flooded_total"), + prometheus.BuildFQName(Namespace, buildSubsystemName("vswitch"), "packets_flooded_total"), "This counter represents the total number of packets flooded by the virtual switch", nil, nil, ), Packets: prometheus.NewDesc( - prometheus.BuildFQName(Namespace, "switch", "packets_total"), + prometheus.BuildFQName(Namespace, buildSubsystemName("vswitch"), "packets_total"), "This represents the total number of packets per second traversing the virtual switch", nil, nil, ), PacketsReceived: prometheus.NewDesc( - prometheus.BuildFQName(Namespace, "switch", "packets_received_total"), + prometheus.BuildFQName(Namespace, buildSubsystemName("vswitch"), "packets_received_total"), "This represents the total number of packets received per second by the virtual switch", nil, nil, ), PacketsSent: prometheus.NewDesc( - prometheus.BuildFQName(Namespace, "switch", "packets_sent_total"), + prometheus.BuildFQName(Namespace, buildSubsystemName("vswitch"), "packets_sent_total"), "This represents the total number of packets send per second by the virtual switch", nil, nil, ), PurgedMacAddresses: prometheus.NewDesc( - prometheus.BuildFQName(Namespace, "switch", "purged_mac_addresses_total"), + prometheus.BuildFQName(Namespace, buildSubsystemName("vswitch"), "purged_mac_addresses_total"), "This counter represents the total number of purged MAC addresses of the virtual switch", nil, nil, @@ -427,38 +428,38 @@ func NewHyperVCollector() (Collector, error) { // AdapterBytesDropped: prometheus.NewDesc( - prometheus.BuildFQName(Namespace, "ethernet", "bytes"), + prometheus.BuildFQName(Namespace, buildSubsystemName("ethernet"), "bytes_dropped"), "Bytes Dropped is the number of bytes dropped on the network adapter", nil, nil, ), AdapterBytesReceived: prometheus.NewDesc( - prometheus.BuildFQName(Namespace, "ethernet", "bytes_received"), - "Bytes Received/sec is the number of bytes received per second on the network adapter", + prometheus.BuildFQName(Namespace, buildSubsystemName("ethernet"), "bytes_received"), + "Bytes received is the number of bytes received on the network adapter", nil, nil, ), AdapterBytesSent: prometheus.NewDesc( - prometheus.BuildFQName(Namespace, "ethernet", "bytes_sent"), - "Bytes Sent/sec is the number of bytes sent per second over the network adapter", + prometheus.BuildFQName(Namespace, buildSubsystemName("ethernet"), "bytes_sent"), + "Bytes sent is the number of bytes sent over the network adapter", nil, nil, ), AdapterFramesDropped: prometheus.NewDesc( - prometheus.BuildFQName(Namespace, "ethernet", "frames_dropped"), + prometheus.BuildFQName(Namespace, buildSubsystemName("ethernet"), "frames_dropped"), "Frames Dropped is the number of frames dropped on the network adapter", nil, nil, ), AdapterFramesReceived: prometheus.NewDesc( - prometheus.BuildFQName(Namespace, "ethernet", "frames_received"), - "Frames Received/sec is the number of frames received per second on the network adapter", + prometheus.BuildFQName(Namespace, buildSubsystemName("ethernet"), "frames_received"), + "Frames received is the number of frames received on the network adapter", nil, nil, ), AdapterFramesSent: prometheus.NewDesc( - prometheus.BuildFQName(Namespace, "ethernet", "frames_sent"), - "Frames Sent/sec is the number of frames sent per second over the network adapter", + prometheus.BuildFQName(Namespace, buildSubsystemName("ethernet"), "frames_sent"), + "Frames sent is the number of frames sent over the network adapter", nil, nil, ),