Skip to content

Commit 14d46e3

Browse files
eero-tPaweł Szulik
authored andcommitted
Disable polling of CPU & PIDs cgroups when they are not needed
Fixes: #2932
1 parent 5028171 commit 14d46e3

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

container/libcontainer/helpers.go

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,10 @@ func GetCgroupSubsystems(includedMetrics container.MetricSet) (CgroupSubsystems,
5353
disableCgroups["io"] = struct{}{}
5454
}
5555

56+
if !includedMetrics.Has(container.CpuUsageMetrics) {
57+
disableCgroups["cpu"] = struct{}{}
58+
}
59+
5660
if !includedMetrics.Has(container.CPUSetMetrics) {
5761
disableCgroups["cpuset"] = struct{}{}
5862
}
@@ -69,6 +73,10 @@ func GetCgroupSubsystems(includedMetrics container.MetricSet) (CgroupSubsystems,
6973
disableCgroups["perf_event"] = struct{}{}
7074
}
7175

76+
if !includedMetrics.Has(container.ProcessMetrics) {
77+
disableCgroups["pids"] = struct{}{}
78+
}
79+
7280
return getCgroupSubsystemsHelper(allCgroups, disableCgroups)
7381
}
7482

0 commit comments

Comments
 (0)