@@ -21,6 +21,11 @@ import (
2121 "github.com/prometheus/procfs"
2222)
2323
24+ var (
25+ // 64-bit float mantissa: https://en.wikipedia.org/wiki/Double-precision_floating-point_format
26+ float64Mantissa uint64 = 9007199254740992
27+ )
28+
2429type mountStatsCollector struct {
2530 // General statistics
2631 NFSAgeSecondsTotal * prometheus.Desc
@@ -618,7 +623,7 @@ func (c *mountStatsCollector) updateNFSStats(ch chan<- prometheus.Metric, export
618623 ch <- prometheus .MustNewConstMetric (
619624 c .NFSTransportIdleTimeSeconds ,
620625 prometheus .GaugeValue ,
621- s .Transport .IdleTime . Seconds ( ),
626+ float64 ( s .Transport .IdleTimeSeconds % float64Mantissa ),
622627 export ,
623628 protocol ,
624629 )
@@ -728,7 +733,7 @@ func (c *mountStatsCollector) updateNFSStats(ch chan<- prometheus.Metric, export
728733 ch <- prometheus .MustNewConstMetric (
729734 c .NFSOperationsQueueTimeSecondsTotal ,
730735 prometheus .CounterValue ,
731- op .CumulativeQueueTime . Seconds () ,
736+ float64 ( op .CumulativeQueueMilliseconds % float64Mantissa ) / 1000.0 ,
732737 export ,
733738 protocol ,
734739 op .Operation ,
@@ -737,7 +742,7 @@ func (c *mountStatsCollector) updateNFSStats(ch chan<- prometheus.Metric, export
737742 ch <- prometheus .MustNewConstMetric (
738743 c .NFSOperationsResponseTimeSecondsTotal ,
739744 prometheus .CounterValue ,
740- op .CumulativeTotalResponseTime . Seconds () ,
745+ float64 ( op .CumulativeTotalResponseMilliseconds % float64Mantissa ) / 1000.0 ,
741746 export ,
742747 protocol ,
743748 op .Operation ,
@@ -746,7 +751,7 @@ func (c *mountStatsCollector) updateNFSStats(ch chan<- prometheus.Metric, export
746751 ch <- prometheus .MustNewConstMetric (
747752 c .NFSOperationsRequestTimeSecondsTotal ,
748753 prometheus .CounterValue ,
749- op .CumulativeTotalRequestTime . Seconds () ,
754+ float64 ( op .CumulativeTotalRequestMilliseconds % float64Mantissa ) / 1000.0 ,
750755 export ,
751756 protocol ,
752757 op .Operation ,
0 commit comments