-
Notifications
You must be signed in to change notification settings - Fork 88
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add hostfs
option to Host and Process functions, fix OperatingSystem()
#226
Add hostfs
option to Host and Process functions, fix OperatingSystem()
#226
Conversation
hostfs
option to Host and Process functions, add HostFS functionality to OperatingSystem()
hostfs
option to Host and Process functions, fix OperatingSystem()
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I opened #229 to address the macos build issue.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
Thanks!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM. Made some suggestions to improve docs.
system.go
Outdated
// in the container: | ||
// | ||
// - /proc:/hostfs/proc | ||
// - /sys/fs/cgroup:/hostfs/sys/fs/cgroup |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Considering all things that are "HostFS" aware, are there any other mounts that a user would need to add? What about some combination of /etc/{os,lsb}-release for the OS detection?
The machine ID code isn't host FS aware, and think that creates an inconsistency for users. Do you think that should also be made aware of hostfs?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ah, good catch. Lemme poke around...
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Alright, added the hostfs arg to MachineID. Did some poking around, it seems like everything else in the linux provider should be be hostfs aware if it can't be. One exception is NativeArchitecture()
, which shouldn't matter.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can you please list in the godoc all of the necessary mounts for this example to work.
This fixes a subtle issue in agent's metadata processor where the OS reported by agent will reflect the OS of the container and not the OS of the container host. This is confusing to some users. So, we add an option type that a user can pass to the various metrics methods, as well as alter
OperatingSystem()
so it can take an alternate HostFS value.This also cleans up the error handling a bit, since we had lots of unwrapped errors.
So, I designed this in a way that required the least amount of disruption to the code, but it's at the point where the registry is kind of complicated, and now juggles multiple types around. I was tempted to refactor the whole thing to make it a tad simpler and to avoid casting bare interfaces everywhere, but that felt a little outside the scope of the issue.