fix: procstat missing tags in procstat_lookup metric (#9808)

In #9488 the way that tags were built for procstat_lookup was changed
and it was only including the pid_finder and result tags. This is not
consistent with the documentation and is a regression from how they were
previously constructed.

Becuase of the large change to how procstat metrics are gathered, this
will use one of the process metric's tags as a basis for the tags for
procstat_lookup.

Resolves: #9793
This commit is contained in:
Joshua Powers 2021-10-01 15:10:25 -06:00 committed by GitHub
parent 49e5086390
commit ac40bdc52e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 3 additions and 2 deletions

View File

@ -154,9 +154,10 @@ func (p *Procstat) Gather(acc telegraf.Accumulator) error {
}
}
tags := make(map[string]string)
p.procs = newProcs
for _, proc := range p.procs {
tags = proc.Tags()
p.addMetric(proc, acc, now)
}
@ -165,7 +166,7 @@ func (p *Procstat) Gather(acc telegraf.Accumulator) error {
"running": len(p.procs),
"result_code": 0,
}
tags := make(map[string]string)
tags["pid_finder"] = p.PidFinder
tags["result"] = "success"
acc.AddFields("procstat_lookup", fields, tags, now)