diff options
Diffstat (limited to 'pkg')
-rw-r--r-- | pkg/cgroups/blkio.go | 5 | ||||
-rw-r--r-- | pkg/cgroups/cgroups.go | 1 | ||||
-rw-r--r-- | pkg/cgroups/pids.go | 2 |
3 files changed, 4 insertions, 4 deletions
diff --git a/pkg/cgroups/blkio.go b/pkg/cgroups/blkio.go index 8434703fd..8eb54abec 100644 --- a/pkg/cgroups/blkio.go +++ b/pkg/cgroups/blkio.go @@ -59,8 +59,6 @@ func (c *blkioHandler) Stat(ctr *CgroupControl, m *Metrics) error { } defer f.Close() - var ioServiceBytesRecursive []BlkIOEntry - scanner := bufio.NewScanner(f) for scanner.Scan() { line := scanner.Text() @@ -95,6 +93,9 @@ func (c *blkioHandler) Stat(ctr *CgroupControl, m *Metrics) error { } ioServiceBytesRecursive = append(ioServiceBytesRecursive, entry) } + if err := scanner.Err(); err != nil { + return err + } m.Blkio = BlkioMetrics{IoServiceBytesRecursive: ioServiceBytesRecursive} return nil } diff --git a/pkg/cgroups/cgroups.go b/pkg/cgroups/cgroups.go index 2a88c9db6..24dce71bd 100644 --- a/pkg/cgroups/cgroups.go +++ b/pkg/cgroups/cgroups.go @@ -6,7 +6,6 @@ import ( "os" "path/filepath" "strconv" - "strings" spec "github.com/opencontainers/runtime-spec/specs-go" "github.com/pkg/errors" diff --git a/pkg/cgroups/pids.go b/pkg/cgroups/pids.go index f37ac7611..342b25d85 100644 --- a/pkg/cgroups/pids.go +++ b/pkg/cgroups/pids.go @@ -50,7 +50,7 @@ func (c *pidHandler) Stat(ctr *CgroupControl, m *Metrics) error { return fmt.Errorf("function not implemented yet") } - PIDRoot := ctr.getCgroupv1Path(Pids) + PIDRoot = ctr.getCgroupv1Path(Pids) current, err := readFileAsUint64(filepath.Join(PIDRoot, "pids.current")) if err != nil { |