From 96ad96ccbb0ec92820885c631af8ede23a277c52 Mon Sep 17 00:00:00 2001 From: Naoki MATSUMOTO Date: Thu, 24 Jul 2025 18:33:11 +0900 Subject: [PATCH] Not to use math.Pow10 to convert unit Signed-off-by: Naoki MATSUMOTO --- collector/pcidevice_linux.go | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/collector/pcidevice_linux.go b/collector/pcidevice_linux.go index a9f44e94..2705df79 100644 --- a/collector/pcidevice_linux.go +++ b/collector/pcidevice_linux.go @@ -20,7 +20,6 @@ import ( "errors" "fmt" "log/slog" - "math" "os" "github.com/prometheus/client_golang/prometheus" @@ -126,8 +125,8 @@ func (c *pciDeviceCollector) Update(ch chan<- prometheus.Metric) error { ch <- prometheus.MustNewConstMetric(infoDesc, prometheus.GaugeValue, 1.0, values...) // MaxLinkSpeed and CurrentLinkSpeed are represnted in GT/s - maxLinkSpeedTS := float64(int64(*device.MaxLinkSpeed * math.Pow10(9))) - currentLinkSpeedTS := float64(int64(*device.CurrentLinkSpeed * math.Pow10(9))) + maxLinkSpeedTS := float64(int64(*device.MaxLinkSpeed * 1e9)) + currentLinkSpeedTS := float64(int64(*device.CurrentLinkSpeed * 1e9)) c.pushMetric(ch, "max_link_transfers_per_second", &maxLinkSpeedTS, device.Location, prometheus.GaugeValue) c.pushMetric(ch, "max_link_width", device.MaxLinkWidth, device.Location, prometheus.GaugeValue)