Merge pull request #22556 from containers/renovate/github.com-shirou-gopsutil-v3-3.x

Update module github.com/shirou/gopsutil/v3 to v3.24.4
This commit is contained in:
openshift-merge-bot[bot]
2024-05-01 15:24:33 +00:00
committed by GitHub
6 changed files with 35 additions and 20 deletions

2
go.mod
View File

@ -62,7 +62,7 @@ require (
github.com/opencontainers/selinux v1.11.0 github.com/opencontainers/selinux v1.11.0
github.com/openshift/imagebuilder v1.2.7 github.com/openshift/imagebuilder v1.2.7
github.com/rootless-containers/rootlesskit/v2 v2.1.0 github.com/rootless-containers/rootlesskit/v2 v2.1.0
github.com/shirou/gopsutil/v3 v3.24.3 github.com/shirou/gopsutil/v3 v3.24.4
github.com/sirupsen/logrus v1.9.3 github.com/sirupsen/logrus v1.9.3
github.com/spf13/cobra v1.8.0 github.com/spf13/cobra v1.8.0
github.com/spf13/pflag v1.0.5 github.com/spf13/pflag v1.0.5

5
go.sum
View File

@ -542,8 +542,8 @@ github.com/segmentio/ksuid v1.0.4 h1:sBo2BdShXjmcugAMwjugoGUdUV0pcxY5mW4xKRn3v4c
github.com/segmentio/ksuid v1.0.4/go.mod h1:/XUiZBD3kVx5SmUOl55voK5yeAbBNNIed+2O73XgrPE= github.com/segmentio/ksuid v1.0.4/go.mod h1:/XUiZBD3kVx5SmUOl55voK5yeAbBNNIed+2O73XgrPE=
github.com/sergi/go-diff v1.3.1 h1:xkr+Oxo4BOQKmkn/B9eMK0g5Kg/983T9DqqPHwYqD+8= github.com/sergi/go-diff v1.3.1 h1:xkr+Oxo4BOQKmkn/B9eMK0g5Kg/983T9DqqPHwYqD+8=
github.com/sergi/go-diff v1.3.1/go.mod h1:aMJSSKb2lpPvRNec0+w3fl7LP9IOFzdc9Pa4NFbPK1I= github.com/sergi/go-diff v1.3.1/go.mod h1:aMJSSKb2lpPvRNec0+w3fl7LP9IOFzdc9Pa4NFbPK1I=
github.com/shirou/gopsutil/v3 v3.24.3 h1:eoUGJSmdfLzJ3mxIhmOAhgKEKgQkeOwKpz1NbhVnuPE= github.com/shirou/gopsutil/v3 v3.24.4 h1:dEHgzZXt4LMNm+oYELpzl9YCqV65Yr/6SfrvgRBtXeU=
github.com/shirou/gopsutil/v3 v3.24.3/go.mod h1:JpND7O217xa72ewWz9zN2eIIkPWsDN/3pl0H8Qt0uwg= github.com/shirou/gopsutil/v3 v3.24.4/go.mod h1:lTd2mdiOspcqLgAnr9/nGi71NkeMpWKdmhuxm9GusH8=
github.com/shoenig/go-m1cpu v0.1.6 h1:nxdKQNcEB6vzgA2E2bvzKIYRuNj7XNJ4S/aRSwKzFtM= github.com/shoenig/go-m1cpu v0.1.6 h1:nxdKQNcEB6vzgA2E2bvzKIYRuNj7XNJ4S/aRSwKzFtM=
github.com/shoenig/go-m1cpu v0.1.6/go.mod h1:1JJMcUBvfNwpq05QDQVAnx3gUHr9IYF7GNg9SUEw2VQ= github.com/shoenig/go-m1cpu v0.1.6/go.mod h1:1JJMcUBvfNwpq05QDQVAnx3gUHr9IYF7GNg9SUEw2VQ=
github.com/shoenig/test v0.6.4 h1:kVTaSd7WLz5WZ2IaoM0RSzRsUD+m8wRR+5qvntpn4LU= github.com/shoenig/test v0.6.4 h1:kVTaSd7WLz5WZ2IaoM0RSzRsUD+m8wRR+5qvntpn4LU=
@ -785,7 +785,6 @@ golang.org/x/sys v0.6.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/sys v0.8.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.8.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/sys v0.11.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.11.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/sys v0.17.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= golang.org/x/sys v0.17.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA=
golang.org/x/sys v0.18.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA=
golang.org/x/sys v0.19.0 h1:q5f1RH2jigJ1MoAWp2KTp3gm5zAGFUTarQZ5U386+4o= golang.org/x/sys v0.19.0 h1:q5f1RH2jigJ1MoAWp2KTp3gm5zAGFUTarQZ5U386+4o=
golang.org/x/sys v0.19.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= golang.org/x/sys v0.19.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA=
golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo= golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo=

View File

@ -6,7 +6,7 @@ import (
) )
// Sleep awaits for provided interval. // Sleep awaits for provided interval.
// Can be interrupted by context cancelation. // Can be interrupted by context cancellation.
func Sleep(ctx context.Context, interval time.Duration) error { func Sleep(ctx context.Context, interval time.Duration) error {
timer := time.NewTimer(interval) timer := time.NewTimer(interval)
select { select {

View File

@ -471,7 +471,7 @@ func connectionsPidMaxWithoutUidsWithContext(ctx context.Context, kind string, p
} }
} }
if err != nil { if err != nil {
return nil, fmt.Errorf("cound not get pid(s), %d: %w", pid, err) return nil, fmt.Errorf("could not get pid(s), %d: %w", pid, err)
} }
return statsFromInodesWithContext(ctx, root, pid, tmap, inodes, skipUids) return statsFromInodesWithContext(ctx, root, pid, tmap, inodes, skipUids)
} }

View File

@ -23,9 +23,9 @@ func ParseNetstat(output string, mode string,
exists := make([]string, 0, len(lines)-1) exists := make([]string, 0, len(lines)-1)
columns := 6 columns := 9
if mode == "ind" { if mode == "inb" {
columns = 10 columns = 6
} }
for _, line := range lines { for _, line := range lines {
values := strings.Fields(line) values := strings.Fields(line)
@ -48,18 +48,23 @@ func ParseNetstat(output string, mode string,
parsed := make([]uint64, 0, 8) parsed := make([]uint64, 0, 8)
var vv []string var vv []string
if mode == "inb" { switch mode {
case "inb":
vv = []string{ vv = []string{
values[base+3], // BytesRecv values[base+3], // BytesRecv
values[base+4], // BytesSent values[base+4], // BytesSent
} }
} else { case "ind":
vv = []string{ vv = []string{
values[base+3], // Ipkts values[base+3], // Ipkts
values[base+4], // Ierrs values[base+4], // Idrop
values[base+5], // Opkts values[base+5], // Opkts
values[base+6], // Odrops
}
case "ine":
vv = []string{
values[base+4], // Ierrs
values[base+6], // Oerrs values[base+6], // Oerrs
values[base+8], // Drops
} }
} }
for _, target := range vv { for _, target := range vv {
@ -80,16 +85,19 @@ func ParseNetstat(output string, mode string,
if !present { if !present {
n = IOCountersStat{Name: values[0]} n = IOCountersStat{Name: values[0]}
} }
if mode == "inb" {
switch mode {
case "inb":
n.BytesRecv = parsed[0] n.BytesRecv = parsed[0]
n.BytesSent = parsed[1] n.BytesSent = parsed[1]
} else { case "ind":
n.PacketsRecv = parsed[0] n.PacketsRecv = parsed[0]
n.Errin = parsed[1] n.Dropin = parsed[1]
n.PacketsSent = parsed[2] n.PacketsSent = parsed[2]
n.Errout = parsed[3] n.Dropout = parsed[3]
n.Dropin = parsed[4] case "ine":
n.Dropout = parsed[4] n.Errin = parsed[0]
n.Errout = parsed[1]
} }
iocs[n.Name] = n iocs[n.Name] = n
@ -114,6 +122,10 @@ func IOCountersWithContext(ctx context.Context, pernic bool) ([]IOCountersStat,
if err != nil { if err != nil {
return nil, err return nil, err
} }
out3, err := invoke.CommandWithContext(ctx, netstat, "-ine")
if err != nil {
return nil, err
}
iocs := make(map[string]IOCountersStat) iocs := make(map[string]IOCountersStat)
lines := strings.Split(string(out), "\n") lines := strings.Split(string(out), "\n")
@ -127,6 +139,10 @@ func IOCountersWithContext(ctx context.Context, pernic bool) ([]IOCountersStat,
if err != nil { if err != nil {
return nil, err return nil, err
} }
err = ParseNetstat(string(out3), "ine", iocs)
if err != nil {
return nil, err
}
for _, ioc := range iocs { for _, ioc := range iocs {
ret = append(ret, ioc) ret = append(ret, ioc)

2
vendor/modules.txt vendored
View File

@ -973,7 +973,7 @@ github.com/secure-systems-lab/go-securesystemslib/encrypted
# github.com/segmentio/ksuid v1.0.4 # github.com/segmentio/ksuid v1.0.4
## explicit; go 1.12 ## explicit; go 1.12
github.com/segmentio/ksuid github.com/segmentio/ksuid
# github.com/shirou/gopsutil/v3 v3.24.3 # github.com/shirou/gopsutil/v3 v3.24.4
## explicit; go 1.15 ## explicit; go 1.15
github.com/shirou/gopsutil/v3/common github.com/shirou/gopsutil/v3/common
github.com/shirou/gopsutil/v3/cpu github.com/shirou/gopsutil/v3/cpu