@@ -18,6 +18,7 @@ package collector
18
18
19
19
import (
20
20
"fmt"
21
+ "strconv"
21
22
22
23
"github.com/go-kit/log"
23
24
"github.com/go-kit/log/level"
@@ -129,6 +130,7 @@ func NewMountStatsCollector(logger log.Logger) (Collector, error) {
129
130
130
131
var (
131
132
labels = []string {"export" , "protocol" , "mountaddr" }
133
+ trLabels = []string {"export" , "protocol" , "mountaddr" , "port" }
132
134
opLabels = []string {"export" , "protocol" , "mountaddr" , "operation" }
133
135
)
134
136
@@ -199,70 +201,70 @@ func NewMountStatsCollector(logger log.Logger) (Collector, error) {
199
201
NFSTransportBindTotal : prometheus .NewDesc (
200
202
prometheus .BuildFQName (namespace , subsystem , "transport_bind_total" ),
201
203
"Number of times the client has had to establish a connection from scratch to the NFS server." ,
202
- labels ,
204
+ trLabels ,
203
205
nil ,
204
206
),
205
207
206
208
NFSTransportConnectTotal : prometheus .NewDesc (
207
209
prometheus .BuildFQName (namespace , subsystem , "transport_connect_total" ),
208
210
"Number of times the client has made a TCP connection to the NFS server." ,
209
- labels ,
211
+ trLabels ,
210
212
nil ,
211
213
),
212
214
213
215
NFSTransportIdleTimeSeconds : prometheus .NewDesc (
214
216
prometheus .BuildFQName (namespace , subsystem , "transport_idle_time_seconds" ),
215
217
"Duration since the NFS mount last saw any RPC traffic, in seconds." ,
216
- labels ,
218
+ trLabels ,
217
219
nil ,
218
220
),
219
221
220
222
NFSTransportSendsTotal : prometheus .NewDesc (
221
223
prometheus .BuildFQName (namespace , subsystem , "transport_sends_total" ),
222
224
"Number of RPC requests for this mount sent to the NFS server." ,
223
- labels ,
225
+ trLabels ,
224
226
nil ,
225
227
),
226
228
227
229
NFSTransportReceivesTotal : prometheus .NewDesc (
228
230
prometheus .BuildFQName (namespace , subsystem , "transport_receives_total" ),
229
231
"Number of RPC responses for this mount received from the NFS server." ,
230
- labels ,
232
+ trLabels ,
231
233
nil ,
232
234
),
233
235
234
236
NFSTransportBadTransactionIDsTotal : prometheus .NewDesc (
235
237
prometheus .BuildFQName (namespace , subsystem , "transport_bad_transaction_ids_total" ),
236
238
"Number of times the NFS server sent a response with a transaction ID unknown to this client." ,
237
- labels ,
239
+ trLabels ,
238
240
nil ,
239
241
),
240
242
241
243
NFSTransportBacklogQueueTotal : prometheus .NewDesc (
242
244
prometheus .BuildFQName (namespace , subsystem , "transport_backlog_queue_total" ),
243
245
"Total number of items added to the RPC backlog queue." ,
244
- labels ,
246
+ trLabels ,
245
247
nil ,
246
248
),
247
249
248
250
NFSTransportMaximumRPCSlots : prometheus .NewDesc (
249
251
prometheus .BuildFQName (namespace , subsystem , "transport_maximum_rpc_slots" ),
250
252
"Maximum number of simultaneously active RPC requests ever used." ,
251
- labels ,
253
+ trLabels ,
252
254
nil ,
253
255
),
254
256
255
257
NFSTransportSendingQueueTotal : prometheus .NewDesc (
256
258
prometheus .BuildFQName (namespace , subsystem , "transport_sending_queue_total" ),
257
259
"Total number of items added to the RPC transmission sending queue." ,
258
- labels ,
260
+ trLabels ,
259
261
nil ,
260
262
),
261
263
262
264
NFSTransportPendingQueueTotal : prometheus .NewDesc (
263
265
prometheus .BuildFQName (namespace , subsystem , "transport_pending_queue_total" ),
264
266
"Total number of items added to the RPC transmission pending queue." ,
265
- labels ,
267
+ trLabels ,
266
268
nil ,
267
269
),
268
270
@@ -626,76 +628,79 @@ func (c *mountStatsCollector) updateNFSStats(ch chan<- prometheus.Metric, s *pro
626
628
labelValues ... ,
627
629
)
628
630
629
- tr := lastTransportOrEmpty (s .Transport )
630
- ch <- prometheus .MustNewConstMetric (
631
- c .NFSTransportBindTotal ,
632
- prometheus .CounterValue ,
633
- float64 (tr .Bind ),
634
- labelValues ... ,
635
- )
631
+ for _ , tr := range s .Transport {
632
+ trLabelValues := []string {export , protocol , mountAddress , strconv .FormatUint (tr .Port , 10 )}
636
633
637
- ch <- prometheus .MustNewConstMetric (
638
- c . NFSTransportConnectTotal ,
639
- prometheus .CounterValue ,
640
- float64 (tr .Connect ),
641
- labelValues ... ,
642
- )
634
+ ch <- prometheus .MustNewConstMetric (
635
+ c . NFSTransportBindTotal ,
636
+ prometheus .CounterValue ,
637
+ float64 (tr .Bind ),
638
+ trLabelValues ... ,
639
+ )
643
640
644
- ch <- prometheus .MustNewConstMetric (
645
- c . NFSTransportIdleTimeSeconds ,
646
- prometheus .GaugeValue ,
647
- float64 (tr .IdleTimeSeconds % float64Mantissa ),
648
- labelValues ... ,
649
- )
641
+ ch <- prometheus .MustNewConstMetric (
642
+ c . NFSTransportConnectTotal ,
643
+ prometheus .CounterValue ,
644
+ float64 (tr .Connect ),
645
+ trLabelValues ... ,
646
+ )
650
647
651
- ch <- prometheus .MustNewConstMetric (
652
- c . NFSTransportSendsTotal ,
653
- prometheus .CounterValue ,
654
- float64 (tr .Sends ),
655
- labelValues ... ,
656
- )
648
+ ch <- prometheus .MustNewConstMetric (
649
+ c . NFSTransportIdleTimeSeconds ,
650
+ prometheus .GaugeValue ,
651
+ float64 (tr .IdleTimeSeconds % float64Mantissa ),
652
+ trLabelValues ... ,
653
+ )
657
654
658
- ch <- prometheus .MustNewConstMetric (
659
- c . NFSTransportReceivesTotal ,
660
- prometheus .CounterValue ,
661
- float64 (tr .Receives ),
662
- labelValues ... ,
663
- )
655
+ ch <- prometheus .MustNewConstMetric (
656
+ c . NFSTransportSendsTotal ,
657
+ prometheus .CounterValue ,
658
+ float64 (tr .Sends ),
659
+ trLabelValues ... ,
660
+ )
664
661
665
- ch <- prometheus .MustNewConstMetric (
666
- c . NFSTransportBadTransactionIDsTotal ,
667
- prometheus .CounterValue ,
668
- float64 (tr .BadTransactionIDs ),
669
- labelValues ... ,
670
- )
662
+ ch <- prometheus .MustNewConstMetric (
663
+ c . NFSTransportReceivesTotal ,
664
+ prometheus .CounterValue ,
665
+ float64 (tr .Receives ),
666
+ trLabelValues ... ,
667
+ )
671
668
672
- ch <- prometheus .MustNewConstMetric (
673
- c . NFSTransportBacklogQueueTotal ,
674
- prometheus .CounterValue ,
675
- float64 (tr .CumulativeBacklog ),
676
- labelValues ... ,
677
- )
669
+ ch <- prometheus .MustNewConstMetric (
670
+ c . NFSTransportBadTransactionIDsTotal ,
671
+ prometheus .CounterValue ,
672
+ float64 (tr .BadTransactionIDs ),
673
+ trLabelValues ... ,
674
+ )
678
675
679
- ch <- prometheus .MustNewConstMetric (
680
- c . NFSTransportMaximumRPCSlots ,
681
- prometheus .GaugeValue ,
682
- float64 (tr .MaximumRPCSlotsUsed ),
683
- labelValues ... ,
684
- )
676
+ ch <- prometheus .MustNewConstMetric (
677
+ c . NFSTransportBacklogQueueTotal ,
678
+ prometheus .CounterValue ,
679
+ float64 (tr .CumulativeBacklog ),
680
+ trLabelValues ... ,
681
+ )
685
682
686
- ch <- prometheus .MustNewConstMetric (
687
- c . NFSTransportSendingQueueTotal ,
688
- prometheus .CounterValue ,
689
- float64 (tr .CumulativeSendingQueue ),
690
- labelValues ... ,
691
- )
683
+ ch <- prometheus .MustNewConstMetric (
684
+ c . NFSTransportMaximumRPCSlots ,
685
+ prometheus .GaugeValue ,
686
+ float64 (tr .MaximumRPCSlotsUsed ),
687
+ trLabelValues ... ,
688
+ )
692
689
693
- ch <- prometheus .MustNewConstMetric (
694
- c .NFSTransportPendingQueueTotal ,
695
- prometheus .CounterValue ,
696
- float64 (tr .CumulativePendingQueue ),
697
- labelValues ... ,
698
- )
690
+ ch <- prometheus .MustNewConstMetric (
691
+ c .NFSTransportSendingQueueTotal ,
692
+ prometheus .CounterValue ,
693
+ float64 (tr .CumulativeSendingQueue ),
694
+ trLabelValues ... ,
695
+ )
696
+
697
+ ch <- prometheus .MustNewConstMetric (
698
+ c .NFSTransportPendingQueueTotal ,
699
+ prometheus .CounterValue ,
700
+ float64 (tr .CumulativePendingQueue ),
701
+ trLabelValues ... ,
702
+ )
703
+ }
699
704
700
705
for _ , op := range s .Operations {
701
706
opLabelValues := []string {export , protocol , mountAddress , op .Operation }
0 commit comments