diff options
Diffstat (limited to 'vendor/github.com/prometheus/procfs/mountstats.go')
-rw-r--r-- | vendor/github.com/prometheus/procfs/mountstats.go | 20 |
1 files changed, 14 insertions, 6 deletions
diff --git a/vendor/github.com/prometheus/procfs/mountstats.go b/vendor/github.com/prometheus/procfs/mountstats.go index 35b2ef3..861ced9 100644 --- a/vendor/github.com/prometheus/procfs/mountstats.go +++ b/vendor/github.com/prometheus/procfs/mountstats.go | |||
@@ -186,6 +186,8 @@ type NFSOperationStats struct { | |||
186 | CumulativeTotalResponseMilliseconds uint64 | 186 | CumulativeTotalResponseMilliseconds uint64 |
187 | // Duration from when a request was enqueued to when it was completely handled. | 187 | // Duration from when a request was enqueued to when it was completely handled. |
188 | CumulativeTotalRequestMilliseconds uint64 | 188 | CumulativeTotalRequestMilliseconds uint64 |
189 | // The count of operations that complete with tk_status < 0. These statuses usually indicate error conditions. | ||
190 | Errors uint64 | ||
189 | } | 191 | } |
190 | 192 | ||
191 | // A NFSTransportStats contains statistics for the NFS mount RPC requests and | 193 | // A NFSTransportStats contains statistics for the NFS mount RPC requests and |
@@ -494,8 +496,8 @@ func parseNFSEventsStats(ss []string) (*NFSEventsStats, error) { | |||
494 | // line is reached. | 496 | // line is reached. |
495 | func parseNFSOperationStats(s *bufio.Scanner) ([]NFSOperationStats, error) { | 497 | func parseNFSOperationStats(s *bufio.Scanner) ([]NFSOperationStats, error) { |
496 | const ( | 498 | const ( |
497 | // Number of expected fields in each per-operation statistics set | 499 | // Minimum number of expected fields in each per-operation statistics set |
498 | numFields = 9 | 500 | minFields = 9 |
499 | ) | 501 | ) |
500 | 502 | ||
501 | var ops []NFSOperationStats | 503 | var ops []NFSOperationStats |
@@ -508,12 +510,12 @@ func parseNFSOperationStats(s *bufio.Scanner) ([]NFSOperationStats, error) { | |||
508 | break | 510 | break |
509 | } | 511 | } |
510 | 512 | ||
511 | if len(ss) != numFields { | 513 | if len(ss) < minFields { |
512 | return nil, fmt.Errorf("invalid NFS per-operations stats: %v", ss) | 514 | return nil, fmt.Errorf("invalid NFS per-operations stats: %v", ss) |
513 | } | 515 | } |
514 | 516 | ||
515 | // Skip string operation name for integers | 517 | // Skip string operation name for integers |
516 | ns := make([]uint64, 0, numFields-1) | 518 | ns := make([]uint64, 0, minFields-1) |
517 | for _, st := range ss[1:] { | 519 | for _, st := range ss[1:] { |
518 | n, err := strconv.ParseUint(st, 10, 64) | 520 | n, err := strconv.ParseUint(st, 10, 64) |
519 | if err != nil { | 521 | if err != nil { |
@@ -523,7 +525,7 @@ func parseNFSOperationStats(s *bufio.Scanner) ([]NFSOperationStats, error) { | |||
523 | ns = append(ns, n) | 525 | ns = append(ns, n) |
524 | } | 526 | } |
525 | 527 | ||
526 | ops = append(ops, NFSOperationStats{ | 528 | opStats := NFSOperationStats{ |
527 | Operation: strings.TrimSuffix(ss[0], ":"), | 529 | Operation: strings.TrimSuffix(ss[0], ":"), |
528 | Requests: ns[0], | 530 | Requests: ns[0], |
529 | Transmissions: ns[1], | 531 | Transmissions: ns[1], |
@@ -533,7 +535,13 @@ func parseNFSOperationStats(s *bufio.Scanner) ([]NFSOperationStats, error) { | |||
533 | CumulativeQueueMilliseconds: ns[5], | 535 | CumulativeQueueMilliseconds: ns[5], |
534 | CumulativeTotalResponseMilliseconds: ns[6], | 536 | CumulativeTotalResponseMilliseconds: ns[6], |
535 | CumulativeTotalRequestMilliseconds: ns[7], | 537 | CumulativeTotalRequestMilliseconds: ns[7], |
536 | }) | 538 | } |
539 | |||
540 | if len(ns) > 8 { | ||
541 | opStats.Errors = ns[8] | ||
542 | } | ||
543 | |||
544 | ops = append(ops, opStats) | ||
537 | } | 545 | } |
538 | 546 | ||
539 | return ops, s.Err() | 547 | return ops, s.Err() |