Update procfs library (#1640)
Bump procfs to latest release. Fixes: https://github.com/prometheus/node_exporter/issues/1625 Fixes: https://github.com/prometheus/node_exporter/issues/1634 Signed-off-by: Ben Kochie <superq@gmail.com>
This commit is contained in:
parent
e49a13d0cf
commit
47610d0d2b
17 changed files with 345 additions and 64 deletions
14
vendor/github.com/prometheus/procfs/net_softnet.go
generated
vendored
14
vendor/github.com/prometheus/procfs/net_softnet.go
generated
vendored
|
|
@ -25,7 +25,9 @@ import (
|
|||
)
|
||||
|
||||
// For the proc file format details,
|
||||
// see https://elixir.bootlin.com/linux/v4.17/source/net/core/net-procfs.c#L162
|
||||
// See:
|
||||
// * Linux 2.6.23 https://elixir.bootlin.com/linux/v2.6.23/source/net/core/dev.c#L2343
|
||||
// * Linux 4.17 https://elixir.bootlin.com/linux/v4.17/source/net/core/net-procfs.c#L162
|
||||
// and https://elixir.bootlin.com/linux/v4.17/source/include/linux/netdevice.h#L2810.
|
||||
|
||||
// SoftnetStat contains a single row of data from /proc/net/softnet_stat
|
||||
|
|
@ -38,9 +40,11 @@ type SoftnetStat struct {
|
|||
TimeSqueezed uint32
|
||||
}
|
||||
|
||||
var softNetProcFile = "net/softnet_stat"
|
||||
|
||||
// NetSoftnetStat reads data from /proc/net/softnet_stat.
|
||||
func (fs FS) NetSoftnetStat() ([]SoftnetStat, error) {
|
||||
b, err := util.ReadFileNoStat(fs.proc.Path("net/softnet_stat"))
|
||||
b, err := util.ReadFileNoStat(fs.proc.Path(softNetProcFile))
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
|
@ -54,7 +58,7 @@ func (fs FS) NetSoftnetStat() ([]SoftnetStat, error) {
|
|||
}
|
||||
|
||||
func parseSoftnet(r io.Reader) ([]SoftnetStat, error) {
|
||||
const expectedColumns = 11
|
||||
const minColumns = 9
|
||||
|
||||
s := bufio.NewScanner(r)
|
||||
|
||||
|
|
@ -63,8 +67,8 @@ func parseSoftnet(r io.Reader) ([]SoftnetStat, error) {
|
|||
columns := strings.Fields(s.Text())
|
||||
width := len(columns)
|
||||
|
||||
if width != 11 {
|
||||
return nil, fmt.Errorf("%d columns were detected, but %d were expected", width, expectedColumns)
|
||||
if width < minColumns {
|
||||
return nil, fmt.Errorf("%d columns were detected, but at least %d were expected", width, minColumns)
|
||||
}
|
||||
|
||||
// We only parse the first three columns at the moment.
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue