Skip to content

Commit

Permalink
Really fix procstat initialization
Browse files Browse the repository at this point in the history
  • Loading branch information
danielnelson authored and Vladislav Mugultyanov (Lazada Group) committed May 30, 2017
1 parent 143808d commit 283f9ad
Showing 1 changed file with 8 additions and 4 deletions.
12 changes: 8 additions & 4 deletions plugins/inputs/procstat/procstat.go
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,13 @@ func (_ *Procstat) Description() string {
}

func (p *Procstat) Gather(acc telegraf.Accumulator) error {
if p.createPIDFinder == nil {
p.createPIDFinder = defaultPIDFinder
}
if p.createProcess == nil {
p.createProcess = defaultProcess
}

procs, err := p.updateProcesses(p.procs)
if err != nil {
return fmt.Errorf(
Expand Down Expand Up @@ -235,9 +242,6 @@ func (p *Procstat) findPids() ([]PID, map[string]string, error) {

func init() {
inputs.Add("procstat", func() telegraf.Input {
return &Procstat{
createPIDFinder: defaultPIDFinder,
createProcess: defaultProcess,
}
return &Procstat{}
})
}

0 comments on commit 283f9ad

Please sign in to comment.