mirror of
https://github.com/ceph/ceph-csi.git
synced 2025-06-14 18:53:35 +00:00
rebase: bump github.com/prometheus/client_golang from 1.14.0 to 1.15.1
Bumps [github.com/prometheus/client_golang](https://github.com/prometheus/client_golang) from 1.14.0 to 1.15.1. - [Release notes](https://github.com/prometheus/client_golang/releases) - [Changelog](https://github.com/prometheus/client_golang/blob/main/CHANGELOG.md) - [Commits](https://github.com/prometheus/client_golang/compare/v1.14.0...v1.15.1) --- updated-dependencies: - dependency-name: github.com/prometheus/client_golang dependency-type: direct:production update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] <support@github.com>
This commit is contained in:
committed by
mergify[bot]
parent
8265abc2c9
commit
d0626d42e0
22
vendor/github.com/prometheus/procfs/stat.go
generated
vendored
22
vendor/github.com/prometheus/procfs/stat.go
generated
vendored
@ -62,7 +62,7 @@ type Stat struct {
|
||||
// Summed up cpu statistics.
|
||||
CPUTotal CPUStat
|
||||
// Per-CPU statistics.
|
||||
CPU []CPUStat
|
||||
CPU map[int64]CPUStat
|
||||
// Number of times interrupts were handled, which contains numbered and unnumbered IRQs.
|
||||
IRQTotal uint64
|
||||
// Number of times a numbered IRQ was triggered.
|
||||
@ -170,10 +170,23 @@ func (fs FS) Stat() (Stat, error) {
|
||||
if err != nil {
|
||||
return Stat{}, err
|
||||
}
|
||||
procStat, err := parseStat(bytes.NewReader(data), fileName)
|
||||
if err != nil {
|
||||
return Stat{}, err
|
||||
}
|
||||
return procStat, nil
|
||||
}
|
||||
|
||||
stat := Stat{}
|
||||
// parseStat parses the metrics from /proc/[pid]/stat.
|
||||
func parseStat(r io.Reader, fileName string) (Stat, error) {
|
||||
var (
|
||||
scanner = bufio.NewScanner(r)
|
||||
stat = Stat{
|
||||
CPU: make(map[int64]CPUStat),
|
||||
}
|
||||
err error
|
||||
)
|
||||
|
||||
scanner := bufio.NewScanner(bytes.NewReader(data))
|
||||
for scanner.Scan() {
|
||||
line := scanner.Text()
|
||||
parts := strings.Fields(scanner.Text())
|
||||
@ -228,9 +241,6 @@ func (fs FS) Stat() (Stat, error) {
|
||||
if cpuID == -1 {
|
||||
stat.CPUTotal = cpuStat
|
||||
} else {
|
||||
for int64(len(stat.CPU)) <= cpuID {
|
||||
stat.CPU = append(stat.CPU, CPUStat{})
|
||||
}
|
||||
stat.CPU[cpuID] = cpuStat
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user