mirror of
				https://github.com/prometheus/node_exporter.git
				synced 2025-08-20 18:33:52 -07:00 
			
		
		
		
	Not to use math.Pow10 to convert unit
Signed-off-by: Naoki MATSUMOTO <m.naoki9911@gmail.com>
This commit is contained in:
		
							parent
							
								
									9f65ec3485
								
							
						
					
					
						commit
						96ad96ccbb
					
				| 
						 | 
				
			
			@ -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)
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
		Reference in a new issue