Skip to content
This repository has been archived by the owner on Aug 22, 2024. It is now read-only.

Commit

Permalink
Reduce messages severity from error to warning. Occurred events don't…
Browse files Browse the repository at this point in the history
… interrupt collecting metrics, hence could be considered as warnings.
  • Loading branch information
lesovsky committed Apr 6, 2021
1 parent 38c3bf7 commit 75946db
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions internal/collector/filesystem_common.go
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ func parseProcMounts(r io.Reader, filters map[string]filter.Filter) ([]mount, er
// truncateDeviceName truncates passed full path to device to short device name.
func truncateDeviceName(path string) string {
if path == "" {
log.Warnf("empty path passed")
log.Warnf("cannot truncate empty device path")
return ""
}
// Make name which will be returned in case of later errors occurred.
Expand All @@ -70,15 +70,15 @@ func truncateDeviceName(path string) string {
// Check device path exists.
fi, err := os.Lstat(path)
if err != nil {
log.Errorf("stat device path %s failed: %s, use defaults (%s)", path, err, name)
log.Warnf("%s, use default '%s'", err, name)
return name
}

// If path is symlink, try dereference it.
if fi.Mode()&os.ModeSymlink != 0 {
resolved, err := os.Readlink(path)
if err != nil {
log.Errorf("dereference device path %s failed: %s, use name's last part (%s)", path, err, name)
log.Warnf("%s, use name's last part '%s'", err, name)
return name
}
// Swap name to dereferenced origin.
Expand Down

0 comments on commit 75946db

Please sign in to comment.