@@ -103,6 +103,7 @@ type nfsDeviceIdentifier struct {
103103 Device string
104104 Protocol string
105105 MountAddress string
106+ MountPoint string
106107}
107108
108109func init () {
@@ -127,9 +128,9 @@ func NewMountStatsCollector(logger *slog.Logger) (Collector, error) {
127128 )
128129
129130 var (
130- labels = []string {"export" , "protocol" , "mountaddr" }
131- opLabels = []string {"export" , "protocol" , "mountaddr" , "operation" }
132- translabels = []string {"export" , "protocol" , "mountaddr" , "transport" }
131+ labels = []string {"export" , "protocol" , "mountaddr" , "mountpoint" }
132+ opLabels = []string {"export" , "protocol" , "mountaddr" , "mountpoint" , " operation" }
133+ translabels = []string {"export" , "protocol" , "mountaddr" , "mountpoint" , " transport" }
133134 )
134135
135136 return & mountStatsCollector {
@@ -531,6 +532,7 @@ func (c *mountStatsCollector) Update(ch chan<- prometheus.Metric) error {
531532 continue
532533 }
533534
535+ mountPoint := m .Mount
534536 var mountAddress string
535537 if idx < len (mountsInfo ) {
536538 // The mount entry order in the /proc/self/mountstats and /proc/self/mountinfo is the same.
@@ -539,22 +541,22 @@ func (c *mountStatsCollector) Update(ch chan<- prometheus.Metric) error {
539541 }
540542
541543 for k := range stats .Transport {
542- deviceIdentifier := nfsDeviceIdentifier {m .Device , stats .Transport [k ].Protocol , mountAddress }
544+ deviceIdentifier := nfsDeviceIdentifier {m .Device , stats .Transport [k ].Protocol , mountAddress , mountPoint }
543545 i := deviceList [deviceIdentifier ]
544546 if i {
545547 c .logger .Debug ("Skipping duplicate device entry" , "device" , deviceIdentifier )
546548 break
547549 }
548550 deviceList [deviceIdentifier ] = true
549- c .updateNFSStats (ch , stats , m .Device , stats .Transport [k ].Protocol , mountAddress )
551+ c .updateNFSStats (ch , stats , m .Device , stats .Transport [k ].Protocol , mountAddress , mountPoint )
550552 }
551553 }
552554
553555 return nil
554556}
555557
556- func (c * mountStatsCollector ) updateNFSStats (ch chan <- prometheus.Metric , s * procfs.MountStatsNFS , export , protocol , mountAddress string ) {
557- labelValues := []string {export , protocol , mountAddress }
558+ func (c * mountStatsCollector ) updateNFSStats (ch chan <- prometheus.Metric , s * procfs.MountStatsNFS , export , protocol , mountAddress , mountPoint string ) {
559+ labelValues := []string {export , protocol , mountAddress , mountPoint }
558560 ch <- prometheus .MustNewConstMetric (
559561 c .NFSAgeSecondsTotal ,
560562 prometheus .CounterValue ,
@@ -619,7 +621,7 @@ func (c *mountStatsCollector) updateNFSStats(ch chan<- prometheus.Metric, s *pro
619621 )
620622
621623 for i := range s .Transport {
622- translabelValues := []string {export , protocol , mountAddress , strconv .Itoa (i )}
624+ translabelValues := []string {export , protocol , mountAddress , mountPoint , strconv .Itoa (i )}
623625
624626 ch <- prometheus .MustNewConstMetric (
625627 c .NFSTransportBindTotal ,
@@ -693,7 +695,7 @@ func (c *mountStatsCollector) updateNFSStats(ch chan<- prometheus.Metric, s *pro
693695 }
694696
695697 for _ , op := range s .Operations {
696- opLabelValues := []string {export , protocol , mountAddress , op .Operation }
698+ opLabelValues := []string {export , protocol , mountAddress , mountPoint , op .Operation }
697699
698700 ch <- prometheus .MustNewConstMetric (
699701 c .NFSOperationsRequestsTotal ,
0 commit comments