Skip to content

Commit 3d1d93e

Browse files
committed
Remove use of deprecated procfs functions
Signed-off-by: beorn7 <[email protected]>
1 parent 674d720 commit 3d1d93e

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

prometheus/process_collector.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -126,7 +126,7 @@ func NewProcessCollector(opts ProcessCollectorOpts) Collector {
126126
}
127127

128128
// Set up process metric collection if supported by the runtime.
129-
if _, err := procfs.NewStat(); err == nil {
129+
if _, err := procfs.NewDefaultFS(); err == nil {
130130
c.collectFn = c.processCollect
131131
} else {
132132
c.collectFn = func(ch chan<- Metric) {
@@ -166,7 +166,7 @@ func (c *processCollector) processCollect(ch chan<- Metric) {
166166
return
167167
}
168168

169-
if stat, err := p.NewStat(); err == nil {
169+
if stat, err := p.Stat(); err == nil {
170170
ch <- MustNewConstMetric(c.cpuTotal, CounterValue, stat.CPUTime())
171171
ch <- MustNewConstMetric(c.vsize, GaugeValue, float64(stat.VirtualMemory()))
172172
ch <- MustNewConstMetric(c.rss, GaugeValue, float64(stat.ResidentMemory()))
@@ -185,7 +185,7 @@ func (c *processCollector) processCollect(ch chan<- Metric) {
185185
c.reportError(ch, c.openFDs, err)
186186
}
187187

188-
if limits, err := p.NewLimits(); err == nil {
188+
if limits, err := p.Limits(); err == nil {
189189
ch <- MustNewConstMetric(c.maxFDs, GaugeValue, float64(limits.OpenFiles))
190190
ch <- MustNewConstMetric(c.maxVsize, GaugeValue, float64(limits.AddressSpace))
191191
} else {

0 commit comments

Comments
 (0)