From 1391f05e8047225713c34fefaa8f4ae45161874a Mon Sep 17 00:00:00 2001 From: Thomas Casteleyn Date: Fri, 22 Oct 2021 23:12:12 +0200 Subject: [PATCH] feat: Add more details to processors.ifname logmessages (#9984) --- plugins/processors/ifname/ifname.go | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/plugins/processors/ifname/ifname.go b/plugins/processors/ifname/ifname.go index 10623c041..eb3fb2333 100644 --- a/plugins/processors/ifname/ifname.go +++ b/plugins/processors/ifname/ifname.go @@ -157,7 +157,7 @@ func (d *IfName) addTag(metric telegraf.Metric) error { for { m, age, err := d.getMap(agent) 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] @@ -171,7 +171,7 @@ func (d *IfName) addTag(metric telegraf.Metric) error { // the interface we're interested in. If the entry is old // enough, retrieve it from the agent once more. 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 { @@ -181,7 +181,7 @@ func (d *IfName) addTag(metric telegraf.Metric) error { } // 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 { err := d.addTag(m) if err != nil { - d.Log.Debugf("Error adding tag %v", err) + d.Log.Debugf("Error adding tag: %v", err) } return []telegraf.Metric{m} }