Avoid duplicate error printing

This commit is contained in:
Holger Obermaier
2026-03-12 10:08:23 +01:00
parent b65576431e
commit a481a34dcd
17 changed files with 71 additions and 86 deletions

View File

@@ -10,7 +10,6 @@ package collectors
import (
"bytes"
"encoding/json"
"errors"
"fmt"
"os"
"os/exec"
@@ -85,7 +84,7 @@ func (m *CustomCmdCollector) Init(config json.RawMessage) error {
}
if len(m.files) == 0 && len(m.cmdFieldsSlice) == 0 {
return errors.New("no metrics to collect")
return fmt.Errorf("%s Init(): no metrics to collect", m.name)
}
m.init = true
return nil