Merge pull request #1220 from yuriyostapenko/hyperv-waittime

Add Hyper-V CPUWaitTimePerDispatch metrics
This commit is contained in:
Ben Reedy 2023-08-09 06:30:52 +10:00 committed by GitHub
commit 68f5c61de8
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 39 additions and 8 deletions

View File

@ -59,16 +59,18 @@ type HyperVCollector struct {
HostLPTotalRunTimePercent *prometheus.Desc
// Win32_PerfRawData_HvStats_HyperVHypervisorRootVirtualProcessor
HostGuestRunTime *prometheus.Desc
HostHypervisorRunTime *prometheus.Desc
HostRemoteRunTime *prometheus.Desc
HostTotalRunTime *prometheus.Desc
HostGuestRunTime *prometheus.Desc
HostHypervisorRunTime *prometheus.Desc
HostRemoteRunTime *prometheus.Desc
HostTotalRunTime *prometheus.Desc
HostCPUWaitTimePerDispatch *prometheus.Desc
// Win32_PerfRawData_HvStats_HyperVHypervisorVirtualProcessor
VMGuestRunTime *prometheus.Desc
VMHypervisorRunTime *prometheus.Desc
VMRemoteRunTime *prometheus.Desc
VMTotalRunTime *prometheus.Desc
VMGuestRunTime *prometheus.Desc
VMHypervisorRunTime *prometheus.Desc
VMRemoteRunTime *prometheus.Desc
VMTotalRunTime *prometheus.Desc
VMCPUWaitTimePerDispatch *prometheus.Desc
// Win32_PerfRawData_NvspSwitchStats_HyperVVirtualSwitch
BroadcastPacketsReceived *prometheus.Desc
@ -362,6 +364,12 @@ func newHyperVCollector(logger log.Logger) (Collector, error) {
[]string{"core"},
nil,
),
HostCPUWaitTimePerDispatch: prometheus.NewDesc(
prometheus.BuildFQName(Namespace, buildSubsystemName("host_cpu"), "wait_time_per_dispatch_total"),
"Time in nanoseconds waiting for a virtual processor to be dispatched onto a logical processor",
[]string{"core"},
nil,
),
//
@ -389,6 +397,12 @@ func newHyperVCollector(logger log.Logger) (Collector, error) {
[]string{"vm", "core"},
nil,
),
VMCPUWaitTimePerDispatch: prometheus.NewDesc(
prometheus.BuildFQName(Namespace, buildSubsystemName("vm_cpu"), "wait_time_per_dispatch_total"),
"Time in nanoseconds waiting for a virtual processor to be dispatched onto a logical processor",
[]string{"vm", "core"},
nil,
),
//
BroadcastPacketsReceived: prometheus.NewDesc(
@ -1093,6 +1107,7 @@ type Win32_PerfRawData_HvStats_HyperVHypervisorRootVirtualProcessor struct {
PercentHypervisorRunTime uint64
PercentRemoteRunTime uint64
PercentTotalRunTime uint64
CPUWaitTimePerDispatch uint64
}
func (c *HyperVCollector) collectHostCpuUsage(ch chan<- prometheus.Metric) (*prometheus.Desc, error) {
@ -1142,6 +1157,12 @@ func (c *HyperVCollector) collectHostCpuUsage(ch chan<- prometheus.Metric) (*pro
coreId,
)
ch <- prometheus.MustNewConstMetric(
c.HostCPUWaitTimePerDispatch,
prometheus.CounterValue,
float64(obj.CPUWaitTimePerDispatch),
coreId,
)
}
return nil, nil
@ -1154,6 +1175,7 @@ type Win32_PerfRawData_HvStats_HyperVHypervisorVirtualProcessor struct {
PercentHypervisorRunTime uint64
PercentRemoteRunTime uint64
PercentTotalRunTime uint64
CPUWaitTimePerDispatch uint64
}
func (c *HyperVCollector) collectVmCpuUsage(ch chan<- prometheus.Metric) (*prometheus.Desc, error) {
@ -1209,6 +1231,13 @@ func (c *HyperVCollector) collectVmCpuUsage(ch chan<- prometheus.Metric) (*prome
vmName, coreId,
)
ch <- prometheus.MustNewConstMetric(
c.VMCPUWaitTimePerDispatch,
prometheus.CounterValue,
float64(obj.CPUWaitTimePerDispatch),
vmName, coreId,
)
}
return nil, nil

View File

@ -51,9 +51,11 @@ Name | Description | Type | Labels
`windows_hyperv_host_cpu_hypervisor_run_time` | _Not yet documented_ | counter | `core`
`windows_hyperv_host_cpu_remote_run_time` | _Not yet documented_ | counter | `core`
`windows_hyperv_host_cpu_total_run_time` | _Not yet documented_ | counter | `core`
`windows_hyperv_host_cpu_wait_time_per_dispatch_total` | _Not yet documented_ | counter | `core`
`windows_hyperv_vm_cpu_guest_run_time` | _Not yet documented_ | counter | `vm`, `core`
`windows_hyperv_vm_cpu_hypervisor_run_time` | _Not yet documented_ | counter | `vm`, `core`
`windows_hyperv_vm_cpu_remote_run_time` | _Not yet documented_ | counter | `vm`, `core`
`windows_hyperv_vm_cpu_wait_time_per_dispatch_total` | _Not yet documented_ | counter | `vm`, `core`
`windows_hyperv_vm_memory_added_total` | _Not yet documented_ | counter | `vm`
`windows_hyperv_vm_memory_pressure_average` | _Not yet documented_ | gauge | `vm`
`windows_hyperv_vm_memory_pressure_current` | _Not yet documented_ | counter | `vm`