Early init of procfs (#1315)

Minor change to match naming convention in other collectors.

Initialize the proc or sys FS instance once while initializing
each collector instead of re-creating for each metric update.

Signed-off-by: Paul Gier <pgier@redhat.com>
This commit is contained in:
Paul Gier 2019-04-10 11:16:12 -05:00 committed by Ben Kochie
commit b1298677aa
8 changed files with 63 additions and 47 deletions

View file

@ -58,7 +58,7 @@ func newIPVSCollector() (*ipvsCollector, error) {
c.fs, err = procfs.NewFS(*procPath)
if err != nil {
return nil, err
return nil, fmt.Errorf("failed to open procfs: %v", err)
}
c.connections = typedDesc{prometheus.NewDesc(