feat: Add more details to processors.ifname logmessages (#9984)

This commit is contained in:
Thomas Casteleyn 2021-10-22 23:12:12 +02:00 committed by GitHub
parent a71d49a63a
commit 1391f05e80
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 4 additions and 4 deletions

View File

@ -157,7 +157,7 @@ func (d *IfName) addTag(metric telegraf.Metric) error {
for { for {
m, age, err := d.getMap(agent) m, age, err := d.getMap(agent)
if err != nil { if err != nil {
return fmt.Errorf("couldn't retrieve the table of interface names: %w", err) return fmt.Errorf("couldn't retrieve the table of interface names for %s: %w", agent, err)
} }
name, found := m[num] name, found := m[num]
@ -171,7 +171,7 @@ func (d *IfName) addTag(metric telegraf.Metric) error {
// the interface we're interested in. If the entry is old // the interface we're interested in. If the entry is old
// enough, retrieve it from the agent once more. // enough, retrieve it from the agent once more.
if age < minRetry { if age < minRetry {
return fmt.Errorf("interface number %d isn't in the table of interface names", num) return fmt.Errorf("interface number %d isn't in the table of interface names on %s", num, agent)
} }
if firstTime { if firstTime {
@ -181,7 +181,7 @@ func (d *IfName) addTag(metric telegraf.Metric) error {
} }
// not found, cache hit, retrying // not found, cache hit, retrying
return fmt.Errorf("missing interface but couldn't retrieve table") return fmt.Errorf("missing interface but couldn't retrieve table for %v", agent)
} }
} }
@ -212,7 +212,7 @@ func (d *IfName) Start(acc telegraf.Accumulator) error {
fn := func(m telegraf.Metric) []telegraf.Metric { fn := func(m telegraf.Metric) []telegraf.Metric {
err := d.addTag(m) err := d.addTag(m)
if err != nil { if err != nil {
d.Log.Debugf("Error adding tag %v", err) d.Log.Debugf("Error adding tag: %v", err)
} }
return []telegraf.Metric{m} return []telegraf.Metric{m}
} }