mirror of
https://github.com/ClickHouse/ClickHouse.git
synced 2024-12-15 02:41:59 +00:00
updates to support cgroupv2 as well
This commit is contained in:
parent
63bfa19465
commit
d4ca058643
@ -68,6 +68,8 @@ AsynchronousMetrics::AsynchronousMetrics(
|
||||
|
||||
openFileIfExists("/sys/fs/cgroup/memory/memory.limit_in_bytes", cgroupmem_limit_in_bytes);
|
||||
openFileIfExists("/sys/fs/cgroup/memory/memory.usage_in_bytes", cgroupmem_usage_in_bytes);
|
||||
openFileIfExists("/sys/fs/cgroup/memory/memory.max", cgroupmem_v2_limit_in_bytes);
|
||||
openFileIfExists("/sys/fs/cgroup/memory/memory.current", cgroupmem_v2_usage_in_bytes);
|
||||
|
||||
openSensors();
|
||||
openBlockDevices();
|
||||
@ -882,7 +884,7 @@ void AsynchronousMetrics::update(TimePoint update_time)
|
||||
}
|
||||
}
|
||||
|
||||
if (cgroupmem_limit_in_bytes && cgroupmem_usage_in_bytes)
|
||||
if (cgroupmem_limit_in_bytes || cgroupmem_usage_in_bytes || cgroupmem_v2_limit_in_bytes || cgroupmem_v2_usage_in_bytes)
|
||||
{
|
||||
try {
|
||||
cgroupmem_limit_in_bytes->rewind();
|
||||
@ -894,6 +896,13 @@ void AsynchronousMetrics::update(TimePoint update_time)
|
||||
readText(cgroup_mem_limit_in_bytes, *cgroupmem_limit_in_bytes);
|
||||
readText(cgroup_mem_usage_in_bytes, *cgroupmem_usage_in_bytes);
|
||||
|
||||
if (!cgroup_mem_limit_in_bytes && !cgroup_mem_limit_in_bytes) {
|
||||
cgroupmem_v2_limit_in_bytes->rewind();
|
||||
cgroupmem_v2_usage_in_bytes->rewind();
|
||||
readText(cgroup_mem_limit_in_bytes, *cgroupmem_v2_limit_in_bytes);
|
||||
readText(cgroup_mem_usage_in_bytes, *cgroupmem_v2_usage_in_bytes);
|
||||
}
|
||||
|
||||
if (cgroup_mem_limit_in_bytes && cgroup_mem_usage_in_bytes)
|
||||
{
|
||||
new_values["CgroupMemoryTotal"] = { cgroup_mem_limit_in_bytes, "The total amount of memory in cgroup, in bytes." };
|
||||
|
Loading…
Reference in New Issue
Block a user