Skip to content

Commit ea8c935

Browse files
authored
Merge pull request #593 from prometheus/beorn7/modules
Remove use of deprecated procfs functions
2 parents f0a4556 + 3d1d93e commit ea8c935

File tree

3 files changed

+6
-6
lines changed

3 files changed

+6
-6
lines changed

go.mod

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,6 @@ require (
88
github.com/modern-go/reflect2 v1.0.1 // indirect
99
github.com/prometheus/client_model v0.0.0-20190129233127-fd36f4220a90
1010
github.com/prometheus/common v0.4.1
11-
github.com/prometheus/procfs v0.0.0-20190522114515-bc1a522cf7b1
11+
github.com/prometheus/procfs v0.0.2
1212
github.com/stretchr/testify v1.3.0 // indirect
1313
)

go.sum

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -42,8 +42,8 @@ github.com/prometheus/client_model v0.0.0-20190129233127-fd36f4220a90/go.mod h1:
4242
github.com/prometheus/common v0.4.1 h1:K0MGApIoQvMw27RTdJkPbr3JZ7DNbtxQNyi5STVM6Kw=
4343
github.com/prometheus/common v0.4.1/go.mod h1:TNfzLD0ON7rHzMJeJkieUDPYmFC7Snx/y86RQel1bk4=
4444
github.com/prometheus/procfs v0.0.0-20181005140218-185b4288413d/go.mod h1:c3At6R/oaqEKCNdg8wHV1ftS6bRYblBhIjjI8uT2IGk=
45-
github.com/prometheus/procfs v0.0.0-20190522114515-bc1a522cf7b1 h1:Lo6mRUjdS99f3zxYOUalftWHUoOGaDRqFk1+j0Q57/I=
46-
github.com/prometheus/procfs v0.0.0-20190522114515-bc1a522cf7b1/go.mod h1:TjEm7ze935MbeOT/UhFTIMYKhuLP4wbCsTZCD3I8kEA=
45+
github.com/prometheus/procfs v0.0.2 h1:6LJUbpNm42llc4HRCuvApCSWB/WfhuNo9K98Q9sNGfs=
46+
github.com/prometheus/procfs v0.0.2/go.mod h1:TjEm7ze935MbeOT/UhFTIMYKhuLP4wbCsTZCD3I8kEA=
4747
github.com/sirupsen/logrus v1.2.0/go.mod h1:LxeOpSwHxABJmUn/MG1IvRgCAasNZTLOkJPxbbu5VWo=
4848
github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME=
4949
github.com/stretchr/objx v0.1.1/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME=

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)