-
Notifications
You must be signed in to change notification settings - Fork 2.4k
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 support to disable diskIO metrics #2103
Conversation
Thanks for your pull request. It looks like this may be your first contribution to a Google open source project (if not, look below for help). Before we can look at your pull request, you'll need to sign a Contributor License Agreement (CLA). 📝 Please visit https://cla.developers.google.com/ to sign. Once you've signed (or fixed any issues), please reply here (e.g. What to do if you already signed the CLAIndividual signers
Corporate signers
|
@dashpole @SamSaffron PTAL |
/test pull-cadvisor-e2e |
63e8463
to
201f2f7
Compare
/test cla/google |
/retest |
I signed it! |
1 similar comment
I signed it! |
CLAs look good, thanks! |
@dashpole CLA cert has been fixed, PTAL |
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.
this is a great change to make. Just a couple comments
container/raw/handler.go
Outdated
@@ -117,7 +120,8 @@ func (self *rawContainerHandler) Cleanup() {} | |||
|
|||
func (self *rawContainerHandler) GetSpec() (info.ContainerSpec, error) { | |||
const hasNetwork = false | |||
hasFilesystem := isRootCgroup(self.name) || len(self.externalMounts) > 0 | |||
hasFilesystem := (isRootCgroup(self.name) || len(self.externalMounts) > 0) && |
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.
What is this fixing? It isn't related to diskIO AFAICT
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.
It is a DiskUsageMetrics bug that people will see has_filesystem
be true even they disable disk
metrics. I will extract it and launch a new patch later if what I thought is correct @dashpole
container/common/helpers.go
Outdated
@@ -258,6 +258,13 @@ func assignDeviceNamesToPerDiskStats(namer DeviceNamer, diskStats ...[]info.PerD | |||
} | |||
} | |||
|
|||
// FilterCgroupPaths delete cgroup paths which we do't need base on includeMetrics | |||
func FilterCgroupPaths(cgroups map[string]string, includedMetrics container.MetricSet) { |
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.
rather than filtering out afterwards, I think it would be cleaner to do this when we first get the list of cgroup subsystems: https://github.com/google/cadvisor/blob/master/container/libcontainer/helpers.go#L37.
container/common/helpers.go
Outdated
@@ -258,6 +258,13 @@ func assignDeviceNamesToPerDiskStats(namer DeviceNamer, diskStats ...[]info.PerD | |||
} | |||
} | |||
|
|||
// FilterCgroupPaths delete cgroup paths which we do't need base on includeMetrics | |||
func FilterCgroupPaths(cgroups map[string]string, includedMetrics container.MetricSet) { | |||
if !includedMetrics.Has(container.DiskIOMetrics) { |
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.
we don't currently do this for other ignored metrics. What is the benefit of removing the blkio cgroup from the list of cgroups?
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.
As far as I can see, if we don't remove the blkio cgroup, it would keep extracting data from /sys/fs/cgroup/blkio/(ref:
func getBlkioStat(path string) ([]cgroups.BlkioStatEntry, error) { |
container/libcontainer/handler.go
Outdated
@@ -599,14 +600,16 @@ func setNetworkStats(libcontainerStats *libcontainer.Stats, ret *info.ContainerS | |||
} | |||
} | |||
|
|||
func newContainerStats(libcontainerStats *libcontainer.Stats, withPerCPU bool) *info.ContainerStats { | |||
func newContainerStats(libcontainerStats *libcontainer.Stats, withPerCPU, withDiskIO bool) *info.ContainerStats { |
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.
Now that we are passing in two of these, I would rather just pass ignoreMetrics to the function.
201f2f7
to
1ecbdd5
Compare
@dashpole All comments addressed, PTAL |
container/raw/handler.go
Outdated
@@ -117,7 +119,7 @@ func (self *rawContainerHandler) Cleanup() {} | |||
|
|||
func (self *rawContainerHandler) GetSpec() (info.ContainerSpec, error) { | |||
const hasNetwork = false | |||
hasFilesystem := isRootCgroup(self.name) || len(self.externalMounts) > 0 | |||
hasFilesystem := (isRootCgroup(self.name) || len(self.externalMounts) > 0) |
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.
nit: remove extra parenthesis
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.
looks good after the nit
1ecbdd5
to
4eab5b6
Compare
comments addressed @dashpole |
Add support to disable diskIO metrics
ref:#2045