Added percent suffix for metric names

Signed-off-by: Anton Akhmedzyanov <gloin@gloin.ru>
This commit is contained in:
Anton Akhmedzyanov
2022-08-21 15:36:59 +03:00
parent a722cee322
commit 37ea988125
2 changed files with 16 additions and 16 deletions

View File

@@ -54,9 +54,9 @@ type HyperVCollector struct {
VirtualProcessors *prometheus.Desc
// Win32_PerfRawData_HvStats_HyperVHypervisorLogicalProcessor
HostLPGuestRunTime *prometheus.Desc
HostLPHypervisorRunTime *prometheus.Desc
HostLPTotalRunTime *prometheus.Desc
HostLPGuestRunTimePercent *prometheus.Desc
HostLPHypervisorRunTimePercent *prometheus.Desc
HostLPTotalRunTimePercent *prometheus.Desc
// Win32_PerfRawData_HvStats_HyperVHypervisorRootVirtualProcessor
HostGuestRunTime *prometheus.Desc
@@ -314,20 +314,20 @@ func NewHyperVCollector() (Collector, error) {
//
HostLPGuestRunTime: prometheus.NewDesc(
prometheus.BuildFQName(Namespace, buildSubsystemName("host_lp"), "guest_run_time"),
HostLPGuestRunTimePercent: prometheus.NewDesc(
prometheus.BuildFQName(Namespace, buildSubsystemName("host_lp"), "guest_run_time_percent"),
"The percentage of time spent by the processor in guest code",
[]string{"core"},
nil,
),
HostLPHypervisorRunTime: prometheus.NewDesc(
prometheus.BuildFQName(Namespace, buildSubsystemName("host_lp"), "hypervisor_run_time"),
HostLPHypervisorRunTimePercent: prometheus.NewDesc(
prometheus.BuildFQName(Namespace, buildSubsystemName("host_lp"), "hypervisor_run_time_percent"),
"The percentage of time spent by the processor in hypervisor code",
[]string{"core"},
nil,
),
HostLPTotalRunTime: prometheus.NewDesc(
prometheus.BuildFQName(Namespace, buildSubsystemName("host_lp"), "total_run_time"),
HostLPTotalRunTimePercent: prometheus.NewDesc(
prometheus.BuildFQName(Namespace, buildSubsystemName("host_lp"), "total_run_time_percent"),
"The percentage of time spent by the processor in guest and hypervisor code",
[]string{"core"},
nil,
@@ -1058,21 +1058,21 @@ func (c *HyperVCollector) collectHostLPUsage(ch chan<- prometheus.Metric) (*prom
coreId := parts[2]
ch <- prometheus.MustNewConstMetric(
c.HostLPGuestRunTime,
c.HostLPGuestRunTimePercent,
prometheus.GaugeValue,
float64(obj.PercentGuestRunTime),
coreId,
)
ch <- prometheus.MustNewConstMetric(
c.HostLPHypervisorRunTime,
c.HostLPHypervisorRunTimePercent,
prometheus.GaugeValue,
float64(obj.PercentHypervisorRunTime),
coreId,
)
ch <- prometheus.MustNewConstMetric(
c.HostLPTotalRunTime,
c.HostLPTotalRunTimePercent,
prometheus.GaugeValue,
float64(obj.PercentTotalRunTime),
coreId,

View File

@@ -44,9 +44,9 @@ Name | Description | Type | Labels
`windows_hyperv_root_partition_virtual_tlb_pages` | _Not yet documented_ | counter | None
`windows_hyperv_hypervisor_virtual_processors` | _Not yet documented_ | counter | None
`windows_hyperv_hypervisor_logical_processors` | _Not yet documented_ | counter | None
`windows_hyperv_host_lp_guest_run_time` | _Not yet documented_ | counter | `core`
`windows_hyperv_host_lp_hypervisor_run_time` | _Not yet documented_ | counter | `core`
`windows_hyperv_host_lp_total_run_time` | _Not yet documented_ | counter | `core`
`windows_hyperv_host_lp_guest_run_time_percent` | _Not yet documented_ | counter | `core`
`windows_hyperv_host_lp_hypervisor_run_time_percent` | _Not yet documented_ | counter | `core`
`windows_hyperv_host_lp_total_run_time_percent` | _Not yet documented_ | counter | `core`
`windows_hyperv_host_cpu_guest_run_time` | _Not yet documented_ | counter | `core`
`windows_hyperv_host_cpu_hypervisor_run_time` | _Not yet documented_ | counter | `core`
`windows_hyperv_host_cpu_remote_run_time` | _Not yet documented_ | counter | `core`
@@ -123,7 +123,7 @@ Percent of physical CPU resources by the hosts themselves (on all monitored host
```
Percent of physical CPU resources by the hypervisor (on all monitored hosts)
```
(sum by (instance)(rate(windows_hyperv_host_lp_total_run_time{}[1m]))) / sum by (instance)(windows_hyperv_hypervisor_logical_processors{}) / 100000
(sum by (instance)(rate(windows_hyperv_host_lp_total_run_time_percent{}[1m]))) / sum by (instance)(windows_hyperv_hypervisor_logical_processors{}) / 100000
```
## Alerting examples