Skip to content

Commit

Permalink
update procfs to v0.0.2 (prometheus#1376)
Browse files Browse the repository at this point in the history
Signed-off-by: Paul Gier <[email protected]>
  • Loading branch information
pgier authored and oblitorum committed Apr 9, 2024
1 parent d894118 commit 4cf8901
Show file tree
Hide file tree
Showing 33 changed files with 167 additions and 172 deletions.
2 changes: 1 addition & 1 deletion collector/buddyinfo.go
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ func NewBuddyinfoCollector() (Collector, error) {
// Update calls (*buddyinfoCollector).getBuddyInfo to get the platform specific
// buddyinfo metrics.
func (c *buddyinfoCollector) Update(ch chan<- prometheus.Metric) error {
buddyInfo, err := c.fs.NewBuddyInfo()
buddyInfo, err := c.fs.BuddyInfo()
if err != nil {
return fmt.Errorf("couldn't get buddyinfo: %s", err)
}
Expand Down
2 changes: 1 addition & 1 deletion collector/cpu_linux.go
Original file line number Diff line number Diff line change
Expand Up @@ -155,7 +155,7 @@ func (c *cpuCollector) updateThermalThrottle(ch chan<- prometheus.Metric) error

// updateStat reads /proc/stat through procfs and exports cpu related metrics.
func (c *cpuCollector) updateStat(ch chan<- prometheus.Metric) error {
stats, err := c.fs.NewStat()
stats, err := c.fs.Stat()
if err != nil {
return err
}
Expand Down
2 changes: 1 addition & 1 deletion collector/cpufreq_linux.go
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ func NewCPUFreqCollector() (Collector, error) {

// Update implements Collector and exposes cpu related metrics from /proc/stat and /sys/.../cpu/.
func (c *cpuFreqCollector) Update(ch chan<- prometheus.Metric) error {
cpuFreqs, err := c.fs.NewSystemCpufreq()
cpuFreqs, err := c.fs.SystemCpufreq()
if err != nil {
return err
}
Expand Down
4 changes: 2 additions & 2 deletions collector/ipvs_linux.go
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,7 @@ func newIPVSCollector() (*ipvsCollector, error) {
}

func (c *ipvsCollector) Update(ch chan<- prometheus.Metric) error {
ipvsStats, err := c.fs.NewIPVSStats()
ipvsStats, err := c.fs.IPVSStats()
if err != nil {
// Cannot access ipvs metrics, report no error.
if os.IsNotExist(err) {
Expand All @@ -121,7 +121,7 @@ func (c *ipvsCollector) Update(ch chan<- prometheus.Metric) error {
ch <- c.incomingBytes.mustNewConstMetric(float64(ipvsStats.IncomingBytes))
ch <- c.outgoingBytes.mustNewConstMetric(float64(ipvsStats.OutgoingBytes))

backendStats, err := c.fs.NewIPVSBackendStatus()
backendStats, err := c.fs.IPVSBackendStatus()
if err != nil {
return fmt.Errorf("could not get backend status: %s", err)
}
Expand Down
2 changes: 1 addition & 1 deletion collector/netclass_linux.go
Original file line number Diff line number Diff line change
Expand Up @@ -169,7 +169,7 @@ func pushMetric(ch chan<- prometheus.Metric, subsystem string, name string, valu
}

func (c *netClassCollector) getNetClassInfo() (sysfs.NetClass, error) {
netClass, err := c.fs.NewNetClass()
netClass, err := c.fs.NetClass()

if err != nil {
return netClass, fmt.Errorf("error obtaining net class info: %s", err)
Expand Down
2 changes: 1 addition & 1 deletion collector/pressure_linux.go
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ func NewPressureStatsCollector() (Collector, error) {
func (c *pressureStatsCollector) Update(ch chan<- prometheus.Metric) error {
for _, res := range psiResources {
log.Debugf("collecting statistics for resource: %s", res)
vals, err := c.fs.NewPSIStatsForResource(res)
vals, err := c.fs.PSIStatsForResource(res)
if err != nil {
log.Debug("pressure information is unavailable, you need a Linux kernel >= 4.20 and/or CONFIG_PSI enabled for your kernel")
return nil
Expand Down
2 changes: 1 addition & 1 deletion collector/processes_linux.go
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,7 @@ func (c *processCollector) getAllocatedThreads() (int, map[string]int32, int, er
thread := 0
procStates := make(map[string]int32)
for _, pid := range p {
stat, err := pid.NewStat()
stat, err := pid.Stat()
// PIDs can vanish between getting the list and getting stats.
if os.IsNotExist(err) {
log.Debugf("file not found when retrieving stats for pid %v: %q", pid, err)
Expand Down
2 changes: 1 addition & 1 deletion collector/stat_linux.go
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ func NewStatCollector() (Collector, error) {

// Update implements Collector and exposes kernel and system statistics.
func (c *statCollector) Update(ch chan<- prometheus.Metric) error {
stats, err := c.fs.NewStat()
stats, err := c.fs.Stat()
if err != nil {
return err
}
Expand Down
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ require (
github.com/prometheus/client_golang v0.9.2
github.com/prometheus/client_model v0.0.0-20190129233127-fd36f4220a90
github.com/prometheus/common v0.3.0
github.com/prometheus/procfs v0.0.0-20190529155944-65bdadfa96ae
github.com/prometheus/procfs v0.0.2
github.com/siebenmann/go-kstat v0.0.0-20160321171754-d34789b79745
github.com/sirupsen/logrus v1.4.2 // indirect
github.com/soundcloud/go-runit v0.0.0-20150630195641-06ad41a06c4a
Expand Down
4 changes: 2 additions & 2 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -64,8 +64,8 @@ github.com/prometheus/common v0.3.0 h1:taZ4h8Tkxv2kNyoSctBvfXEHmBmxrwmIidZTIaHon
github.com/prometheus/common v0.3.0/go.mod h1:TNfzLD0ON7rHzMJeJkieUDPYmFC7Snx/y86RQel1bk4=
github.com/prometheus/procfs v0.0.0-20181005140218-185b4288413d/go.mod h1:c3At6R/oaqEKCNdg8wHV1ftS6bRYblBhIjjI8uT2IGk=
github.com/prometheus/procfs v0.0.0-20181204211112-1dc9a6cbc91a/go.mod h1:c3At6R/oaqEKCNdg8wHV1ftS6bRYblBhIjjI8uT2IGk=
github.com/prometheus/procfs v0.0.0-20190529155944-65bdadfa96ae h1:kF6Y/ES9NQmW3t400V0XH+lO1jqvCpXBC1XoLDkvuMM=
github.com/prometheus/procfs v0.0.0-20190529155944-65bdadfa96ae/go.mod h1:TjEm7ze935MbeOT/UhFTIMYKhuLP4wbCsTZCD3I8kEA=
github.com/prometheus/procfs v0.0.2 h1:6LJUbpNm42llc4HRCuvApCSWB/WfhuNo9K98Q9sNGfs=
github.com/prometheus/procfs v0.0.2/go.mod h1:TjEm7ze935MbeOT/UhFTIMYKhuLP4wbCsTZCD3I8kEA=
github.com/prometheus/promu v0.2.0 h1:QKoCatPW0XeOG/9ghBv4qESc4G74NHCzuIzsm6SLVt4=
github.com/prometheus/promu v0.2.0/go.mod h1:7vT+16au8n5E4UrtokdU7btmuJ1bF9df9F9s79Cgs3E=
github.com/siebenmann/go-kstat v0.0.0-20160321171754-d34789b79745 h1:IuH7WumZNax0D+rEqmy2TyhKCzrtMGqbZO0b8rO00JA=
Expand Down
6 changes: 5 additions & 1 deletion node_exporter_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -38,9 +38,13 @@ func TestFileDescriptorLeak(t *testing.T) {
if _, err := os.Stat(binary); err != nil {
t.Skipf("node_exporter binary not available, try to run `make build` first: %s", err)
}
if _, err := procfs.NewStat(); err != nil {
fs, err := procfs.NewDefaultFS()
if err != nil {
t.Skipf("proc filesystem is not available, but currently required to read number of open file descriptors: %s", err)
}
if _, err := fs.Stat(); err != nil {
t.Errorf("unable to read process stats: %s", err)
}

exporter := exec.Command(binary, "--web.listen-address", address)
test := func(pid int) error {
Expand Down
11 changes: 9 additions & 2 deletions vendor/github.com/prometheus/procfs/README.md

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 6 additions & 0 deletions vendor/github.com/prometheus/procfs/bcache/get.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

12 changes: 1 addition & 11 deletions vendor/github.com/prometheus/procfs/buddyinfo.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 6 additions & 0 deletions vendor/github.com/prometheus/procfs/fs.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

28 changes: 4 additions & 24 deletions vendor/github.com/prometheus/procfs/ipvs.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

74 changes: 37 additions & 37 deletions vendor/github.com/prometheus/procfs/mdstat.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

18 changes: 4 additions & 14 deletions vendor/github.com/prometheus/procfs/net_dev.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 6 additions & 0 deletions vendor/github.com/prometheus/procfs/nfs/nfs.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading

0 comments on commit 4cf8901

Please sign in to comment.