From 42f28ab8e374137fe3f5d25424489d879d4724f8 Mon Sep 17 00:00:00 2001 From: Christopher Speller Date: Wed, 21 Jun 2017 19:06:17 -0700 Subject: Updating server dependancies (#6712) --- vendor/github.com/prometheus/procfs/sysfs/fs.go | 26 +++++++++++++++++++++++++ 1 file changed, 26 insertions(+) (limited to 'vendor/github.com/prometheus/procfs/sysfs/fs.go') diff --git a/vendor/github.com/prometheus/procfs/sysfs/fs.go b/vendor/github.com/prometheus/procfs/sysfs/fs.go index 8e8380083..fb15d438a 100644 --- a/vendor/github.com/prometheus/procfs/sysfs/fs.go +++ b/vendor/github.com/prometheus/procfs/sysfs/fs.go @@ -18,6 +18,7 @@ import ( "os" "path/filepath" + "github.com/prometheus/procfs/bcache" "github.com/prometheus/procfs/xfs" ) @@ -80,3 +81,28 @@ func (fs FS) XFSStats() ([]*xfs.Stats, error) { return stats, nil } + +// BcacheStats retrieves bcache runtime statistics for each bcache. +func (fs FS) BcacheStats() ([]*bcache.Stats, error) { + matches, err := filepath.Glob(fs.Path("fs/bcache/*-*")) + if err != nil { + return nil, err + } + + stats := make([]*bcache.Stats, 0, len(matches)) + for _, uuidPath := range matches { + // "*-*" in glob above indicates the name of the bcache. + name := filepath.Base(uuidPath) + + // stats + s, err := bcache.GetStats(uuidPath) + if err != nil { + return nil, err + } + + s.Name = name + stats = append(stats, s) + } + + return stats, nil +} -- cgit v1.2.3-1-g7c22