From fd414b3076a85e04c53a0049a2d98fa1983f71e5 Mon Sep 17 00:00:00 2001 From: Christian Rohmann Date: Fri, 23 Feb 2024 10:44:28 +0100 Subject: [PATCH] Fixup for vCPU metrics as libvirt reports nanoseconds --- pkg/exporter/prometheus-libvirt-exporter.go | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/pkg/exporter/prometheus-libvirt-exporter.go b/pkg/exporter/prometheus-libvirt-exporter.go index e1b8b95..7a363d8 100644 --- a/pkg/exporter/prometheus-libvirt-exporter.go +++ b/pkg/exporter/prometheus-libvirt-exporter.go @@ -666,21 +666,21 @@ func CollectDomainVCPUInfo(ch chan<- prometheus.Metric, l *libvirt.Libvirt, doma ch <- prometheus.MustNewConstMetric( libvirtDomainVCPUStatsTime, prometheus.CounterValue, - float64(metric_value), + float64(metric_value)/1e9, promVCPULabels...) case "wait": metric_value := param.Value.I.(uint64) ch <- prometheus.MustNewConstMetric( libvirtDomainVCPUStatsWait, prometheus.CounterValue, - float64(metric_value), + float64(metric_value)/1e9, promVCPULabels...) case "delay": metric_value := param.Value.I.(uint64) ch <- prometheus.MustNewConstMetric( libvirtDomainVCPUStatsDelay, prometheus.CounterValue, - float64(metric_value), + float64(metric_value)/1e9, promVCPULabels...) } }