@@ -235,9 +235,9 @@ func (c *ethtoolCollector) updatePortCapabilities(ch chan<- prometheus.Metric, p
235235 if linkModes & (1 << unix .ETHTOOL_LINK_MODE_Asym_Pause_BIT ) != 0 {
236236 asymmetricPause = 1.0
237237 }
238- ch <- prometheus .MustNewConstMetric (c .entries [ fmt .Sprintf ("%s_autonegotiate" , prefix )] , prometheus .GaugeValue , autonegotiate , device )
239- ch <- prometheus .MustNewConstMetric (c .entries [ fmt .Sprintf ("%s_pause" , prefix )] , prometheus .GaugeValue , pause , device )
240- ch <- prometheus .MustNewConstMetric (c .entries [ fmt .Sprintf ("%s_asymmetricpause" , prefix )] , prometheus .GaugeValue , asymmetricPause , device )
238+ ch <- prometheus .MustNewConstMetric (c .entry ( fmt .Sprintf ("%s_autonegotiate" , prefix )) , prometheus .GaugeValue , autonegotiate , device )
239+ ch <- prometheus .MustNewConstMetric (c .entry ( fmt .Sprintf ("%s_pause" , prefix )) , prometheus .GaugeValue , pause , device )
240+ ch <- prometheus .MustNewConstMetric (c .entry ( fmt .Sprintf ("%s_asymmetricpause" , prefix )) , prometheus .GaugeValue , asymmetricPause , device )
241241}
242242
243243// updatePortInfo generates port type metrics to indicate if the network devices supports Twisted Pair, optical fiber, etc.
@@ -253,7 +253,7 @@ func (c *ethtoolCollector) updatePortInfo(ch chan<- prometheus.Metric, device st
253253 "Backplane" : unix .ETHTOOL_LINK_MODE_Backplane_BIT ,
254254 } {
255255 if linkModes & (1 << bit ) != 0 {
256- ch <- prometheus .MustNewConstMetric (c .entries [ "supported_port" ] , prometheus .GaugeValue , 1.0 , device , name )
256+ ch <- prometheus .MustNewConstMetric (c .entry ( "supported_port" ) , prometheus .GaugeValue , 1.0 , device , name )
257257 }
258258
259259 }
@@ -301,7 +301,7 @@ func (c *ethtoolCollector) updateSpeeds(ch chan<- prometheus.Metric, prefix stri
301301 unix .ETHTOOL_LINK_MODE_25000baseCR_Full_BIT : {25000 , full , "CR" },
302302 } {
303303 if linkModes & (1 << bit ) != 0 {
304- ch <- prometheus .MustNewConstMetric (c .entries [ linkMode ] , prometheus .GaugeValue ,
304+ ch <- prometheus .MustNewConstMetric (c .entry ( linkMode ) , prometheus .GaugeValue ,
305305 float64 (labels .speed )* Mbps , device , labels .duplex , fmt .Sprintf ("%dbase%s" , labels .speed , labels .phy ))
306306 }
307307 }
@@ -336,7 +336,7 @@ func (c *ethtoolCollector) Update(ch chan<- prometheus.Metric) error {
336336 c .updatePortCapabilities (ch , "supported" , device , linkInfo .Supported )
337337 c .updateSpeeds (ch , "advertised" , device , linkInfo .Advertising )
338338 c .updatePortCapabilities (ch , "advertised" , device , linkInfo .Advertising )
339- ch <- prometheus .MustNewConstMetric (c .entries [ "autonegotiate" ] , prometheus .GaugeValue , float64 (linkInfo .Autoneg ), device )
339+ ch <- prometheus .MustNewConstMetric (c .entry ( "autonegotiate" ) , prometheus .GaugeValue , float64 (linkInfo .Autoneg ), device )
340340 } else {
341341 if errno , ok := err .(syscall.Errno ); ok {
342342 if err == unix .EOPNOTSUPP {
0 commit comments