func avoidFileSystem()

in metric/system/filesystem/filesystem.go [180:207]


func avoidFileSystem(fs FSStat) bool {
	// Ignore relative mount points, which are present for example
	// in /proc/mounts on Linux with network namespaces.
	if !filepath.IsAbs(fs.Directory) {
		debugf("Filtering filesystem with relative mountpoint %+v", fs)
		return false
	}

	// Don't do further checks in special devices
	if !filepath.IsAbs(fs.Device) {
		return true
	}

	// This logic only applies on non-windows machines, the device path logic seems to be different on windows.
	if runtime.GOOS != "windows" {
		// If the device name is a directory, this is a bind mount or nullfs,
		// don't count it as it'd be counting again its parent filesystem.
		devFileInfo, err := os.Stat(fs.Device)
		if err != nil {
			debugf("error stating filesystem: %s", err)
		}
		if devFileInfo != nil && devFileInfo.IsDir() {
			return false
		}
	}

	return true
}