aboutsummaryrefslogtreecommitdiff
path: root/vendor
diff options
context:
space:
mode:
authorBen Kochie <superq@gmail.com>2018-02-15 13:40:38 +0100
committerGitHub <noreply@github.com>2018-02-15 13:40:38 +0100
commit01bd99fb1a3a7fca02deaa5cf5ba7f667ea33ea7 (patch)
treede182e946979c54a82ac3c9f47f717ac36663e58 /vendor
parent52c031890ee6d2b97097f05b86457318afea5532 (diff)
downloadprometheus_node_collector-01bd99fb1a3a7fca02deaa5cf5ba7f667ea33ea7.tar.bz2
prometheus_node_collector-01bd99fb1a3a7fca02deaa5cf5ba7f667ea33ea7.tar.xz
prometheus_node_collector-01bd99fb1a3a7fca02deaa5cf5ba7f667ea33ea7.zip
Refactor NFS client collector (#816)
* Update vendor github.com/prometheus/procfs/... * Refactor NFS collector Use new procfs library to parse NFS client stats. * Ignore nfs proc file not existing. * Refactor with reflection to walk the structs.
Diffstat (limited to 'vendor')
-rw-r--r--vendor/github.com/prometheus/procfs/fs.go4
-rw-r--r--vendor/github.com/prometheus/procfs/nfs/parse.go13
-rw-r--r--vendor/github.com/prometheus/procfs/nfs/parse_nfs.go10
-rw-r--r--vendor/vendor.json28
4 files changed, 32 insertions, 23 deletions
diff --git a/vendor/github.com/prometheus/procfs/fs.go b/vendor/github.com/prometheus/procfs/fs.go
index 36c1586..65f0922 100644
--- a/vendor/github.com/prometheus/procfs/fs.go
+++ b/vendor/github.com/prometheus/procfs/fs.go
@@ -46,8 +46,8 @@ func (fs FS) XFSStats() (*xfs.Stats, error) {
46 return xfs.ParseStats(f) 46 return xfs.ParseStats(f)
47} 47}
48 48
49// NFSdClientRPCStats retrieves NFS daemon RPC statistics. 49// NFSClientRPCStats retrieves NFS client RPC statistics.
50func (fs FS) NFSdClientRPCStats() (*nfs.ClientRPCStats, error) { 50func (fs FS) NFSClientRPCStats() (*nfs.ClientRPCStats, error) {
51 f, err := os.Open(fs.Path("net/rpc/nfs")) 51 f, err := os.Open(fs.Path("net/rpc/nfs"))
52 if err != nil { 52 if err != nil {
53 return nil, err 53 return nil, err
diff --git a/vendor/github.com/prometheus/procfs/nfs/parse.go b/vendor/github.com/prometheus/procfs/nfs/parse.go
index 3aa3256..8f568f0 100644
--- a/vendor/github.com/prometheus/procfs/nfs/parse.go
+++ b/vendor/github.com/prometheus/procfs/nfs/parse.go
@@ -178,8 +178,17 @@ func parseV3Stats(v []uint64) (V3Stats, error) {
178 178
179func parseClientV4Stats(v []uint64) (ClientV4Stats, error) { 179func parseClientV4Stats(v []uint64) (ClientV4Stats, error) {
180 values := int(v[0]) 180 values := int(v[0])
181 if len(v[1:]) != values || values < 59 { 181 if len(v[1:]) != values {
182 return ClientV4Stats{}, fmt.Errorf("invalid V4Stats line %q", v) 182 return ClientV4Stats{}, fmt.Errorf("invalid ClientV4Stats line %q", v)
183 }
184
185 // This function currently supports mapping 59 NFS v4 client stats. Older
186 // kernels may emit fewer stats, so we must detect this and pad out the
187 // values to match the expected slice size.
188 if values < 59 {
189 newValues := make([]uint64, 60)
190 copy(newValues, v)
191 v = newValues
183 } 192 }
184 193
185 return ClientV4Stats{ 194 return ClientV4Stats{
diff --git a/vendor/github.com/prometheus/procfs/nfs/parse_nfs.go b/vendor/github.com/prometheus/procfs/nfs/parse_nfs.go
index b5c0b15..c0d3a5a 100644
--- a/vendor/github.com/prometheus/procfs/nfs/parse_nfs.go
+++ b/vendor/github.com/prometheus/procfs/nfs/parse_nfs.go
@@ -32,12 +32,12 @@ func ParseClientRPCStats(r io.Reader) (*ClientRPCStats, error) {
32 parts := strings.Fields(scanner.Text()) 32 parts := strings.Fields(scanner.Text())
33 // require at least <key> <value> 33 // require at least <key> <value>
34 if len(parts) < 2 { 34 if len(parts) < 2 {
35 return nil, fmt.Errorf("invalid NFSd metric line %q", line) 35 return nil, fmt.Errorf("invalid NFS metric line %q", line)
36 } 36 }
37 37
38 values, err := util.ParseUint64s(parts[1:]) 38 values, err := util.ParseUint64s(parts[1:])
39 if err != nil { 39 if err != nil {
40 return nil, fmt.Errorf("error parsing NFSd metric line: %s", err) 40 return nil, fmt.Errorf("error parsing NFS metric line: %s", err)
41 } 41 }
42 42
43 switch metricLine := parts[0]; metricLine { 43 switch metricLine := parts[0]; metricLine {
@@ -52,15 +52,15 @@ func ParseClientRPCStats(r io.Reader) (*ClientRPCStats, error) {
52 case "proc4": 52 case "proc4":
53 stats.ClientV4Stats, err = parseClientV4Stats(values) 53 stats.ClientV4Stats, err = parseClientV4Stats(values)
54 default: 54 default:
55 return nil, fmt.Errorf("unknown NFSd metric line %q", metricLine) 55 return nil, fmt.Errorf("unknown NFS metric line %q", metricLine)
56 } 56 }
57 if err != nil { 57 if err != nil {
58 return nil, fmt.Errorf("errors parsing NFSd metric line: %s", err) 58 return nil, fmt.Errorf("errors parsing NFS metric line: %s", err)
59 } 59 }
60 } 60 }
61 61
62 if err := scanner.Err(); err != nil { 62 if err := scanner.Err(); err != nil {
63 return nil, fmt.Errorf("error scanning NFSd file: %s", err) 63 return nil, fmt.Errorf("error scanning NFS file: %s", err)
64 } 64 }
65 65
66 return stats, nil 66 return stats, nil
diff --git a/vendor/vendor.json b/vendor/vendor.json
index 20391c0..4b43706 100644
--- a/vendor/vendor.json
+++ b/vendor/vendor.json
@@ -161,40 +161,40 @@
161 "revisionTime": "2018-01-10T21:49:58Z" 161 "revisionTime": "2018-01-10T21:49:58Z"
162 }, 162 },
163 { 163 {
164 "checksumSHA1": "lolK0h7LSVERIX8zLyVQ/+7wEyA=", 164 "checksumSHA1": "Qvc01kv3ttHV2P2+J68g9ioU4Qs=",
165 "path": "github.com/prometheus/procfs", 165 "path": "github.com/prometheus/procfs",
166 "revision": "cb4147076ac75738c9a7d279075a253c0cc5acbd", 166 "revision": "282c8707aa210456a825798969cc27edda34992a",
167 "revisionTime": "2018-01-25T13:30:57Z" 167 "revisionTime": "2018-02-12T14:59:26Z"
168 }, 168 },
169 { 169 {
170 "checksumSHA1": "O64FotgWPYIpl3m2gvTEPIem+xg=", 170 "checksumSHA1": "O64FotgWPYIpl3m2gvTEPIem+xg=",
171 "path": "github.com/prometheus/procfs/bcache", 171 "path": "github.com/prometheus/procfs/bcache",
172 "revision": "cb4147076ac75738c9a7d279075a253c0cc5acbd", 172 "revision": "282c8707aa210456a825798969cc27edda34992a",
173 "revisionTime": "2018-01-25T13:30:57Z" 173 "revisionTime": "2018-02-12T14:59:26Z"
174 }, 174 },
175 { 175 {
176 "checksumSHA1": "lv9rIcjbVEGo8AT1UCUZXhXrfQc=", 176 "checksumSHA1": "lv9rIcjbVEGo8AT1UCUZXhXrfQc=",
177 "path": "github.com/prometheus/procfs/internal/util", 177 "path": "github.com/prometheus/procfs/internal/util",
178 "revision": "cb4147076ac75738c9a7d279075a253c0cc5acbd", 178 "revision": "282c8707aa210456a825798969cc27edda34992a",
179 "revisionTime": "2018-01-25T13:30:57Z" 179 "revisionTime": "2018-02-12T14:59:26Z"
180 }, 180 },
181 { 181 {
182 "checksumSHA1": "BXJH5h2ri8SU5qC6kkDvTIGCky4=", 182 "checksumSHA1": "EekY1iRG9JY74mDD0jsbFCWbAFs=",
183 "path": "github.com/prometheus/procfs/nfs", 183 "path": "github.com/prometheus/procfs/nfs",
184 "revision": "cb4147076ac75738c9a7d279075a253c0cc5acbd", 184 "revision": "282c8707aa210456a825798969cc27edda34992a",
185 "revisionTime": "2018-01-25T13:30:57Z" 185 "revisionTime": "2018-02-12T14:59:26Z"
186 }, 186 },
187 { 187 {
188 "checksumSHA1": "wMhQkA/xQw3Q8eI+PIAjFmS94Qo=", 188 "checksumSHA1": "wMhQkA/xQw3Q8eI+PIAjFmS94Qo=",
189 "path": "github.com/prometheus/procfs/sysfs", 189 "path": "github.com/prometheus/procfs/sysfs",
190 "revision": "cb4147076ac75738c9a7d279075a253c0cc5acbd", 190 "revision": "282c8707aa210456a825798969cc27edda34992a",
191 "revisionTime": "2018-01-25T13:30:57Z" 191 "revisionTime": "2018-02-12T14:59:26Z"
192 }, 192 },
193 { 193 {
194 "checksumSHA1": "yItvTQLUVqm/ArLEbvEhqG0T5a0=", 194 "checksumSHA1": "yItvTQLUVqm/ArLEbvEhqG0T5a0=",
195 "path": "github.com/prometheus/procfs/xfs", 195 "path": "github.com/prometheus/procfs/xfs",
196 "revision": "cb4147076ac75738c9a7d279075a253c0cc5acbd", 196 "revision": "282c8707aa210456a825798969cc27edda34992a",
197 "revisionTime": "2018-01-25T13:30:57Z" 197 "revisionTime": "2018-02-12T14:59:26Z"
198 }, 198 },
199 { 199 {
200 "checksumSHA1": "ySaT8G3I3y4MmnoXOYAAX0rC+p8=", 200 "checksumSHA1": "ySaT8G3I3y4MmnoXOYAAX0rC+p8=",