Right now, process.GetSelf() fetches the pid of the process with os.Getpid() and then uses the alternate hostfs to fetch the metrics from /proc/GETPID/ There's a problem with this, which you can demonstrate with a small test:
The namespacing is actually smart enough to handle something like /hostfs/proc/self/, but if you do os.Getpid() and then pass that to /hostfs/proc, you'll get an invalid result.
On linux, when we're using hostfs, GetSelf() should use /hostfs/proc/self instead.
Right now,
process.GetSelf()
fetches the pid of the process withos.Getpid()
and then uses the alternate hostfs to fetch the metrics from/proc/GETPID/
There's a problem with this, which you can demonstrate with a small test:This returns:
The namespacing is actually smart enough to handle something like
/hostfs/proc/self/
, but if you doos.Getpid()
and then pass that to/hostfs/proc
, you'll get an invalid result.On linux, when we're using hostfs,
GetSelf()
should use/hostfs/proc/self
instead.