fix: procstat tags were not getting generated correctly (#9973)

Fixes: #9961
This commit is contained in:
Joshua Powers 2021-10-25 13:21:39 -06:00 committed by GitHub
parent 90eeee7824
commit 85a7fbc13f
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 7 additions and 2 deletions

View File

@ -154,13 +154,18 @@ 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)
}
tags := make(map[string]string)
for _, pidTag := range pidTags {
for key, value := range pidTag.Tags {
tags[key] = value
}
}
fields := map[string]interface{}{
"pid_count": pidCount,
"running": len(p.procs),