elastic / elastic-agent-system-metrics

Apache License 2.0
0 stars 22 forks source link

`avoidFileSystem()` needs to handle an alternate rootfs #141

Open fearful-symmetry opened 5 months ago

fearful-symmetry commented 5 months ago

Right now, avoidFileSystem() in filesystem.go doesn't really have any understanding of an alternate hostfs set via a resolver:

devFileInfo, err := os.Stat(fs.Device)
if err != nil {
    debugf("error stating filesystem: %s", err)
}

It should use the resolver for the os.Stat call. However, there's some added complexity here, as in my experience, not all users will mount the entirety of / at /hostfs, which means we'll need some kind of check where if hostfs.IsSet() && err == ENOENT then we print a special error message or something.