-
Notifications
You must be signed in to change notification settings - Fork 761
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
Fix CPU share calculation #5324
Changes from 5 commits
89c8d58
baae08d
224e6f8
ce59004
8f32667
85ab682
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -261,7 +261,7 @@ public long GetMemoryUsageInBytesFromSlices(string pattern) | |
{ | ||
memoryUsageInBytesTotal = 0; | ||
Throw.InvalidOperationException( | ||
$"We tried to read '{memoryUsageInBytesFile}', and we expected to get a positive number but instead it was: '{containerMemoryUsage}'."); | ||
$"We tried to read '{memoryUsageInBytesFile}', and we expected to get a positive number but instead it was: '{memoryUsageFile}'."); | ||
} | ||
|
||
memoryUsageInBytesTotal += containerMemoryUsage; | ||
|
@@ -533,6 +533,9 @@ private static bool TryGetCpuUnitsFromCgroups(IFileSystem fileSystem, out float | |
|
||
private static bool TryGetCgroupRequestCpu(IFileSystem fileSystem, out float cpuUnits) | ||
{ | ||
const long CpuPodWeightPossibleMax = 10_000; | ||
const long CpuPodWeightPossibleMin = 1; | ||
|
||
if (!fileSystem.Exists(_cpuPodWeight)) | ||
{ | ||
cpuUnits = 0; | ||
|
@@ -545,26 +548,33 @@ private static bool TryGetCgroupRequestCpu(IFileSystem fileSystem, out float cpu | |
|
||
if (cpuPodWeightBuffer.IsEmpty || (cpuPodWeightBuffer.Length == 2 && cpuPodWeightBuffer[0] == '-' && cpuPodWeightBuffer[1] == '1')) | ||
{ | ||
Throw.InvalidOperationException($"Could not parse '{_cpuPodWeight}' content. Expected to find CPU weight but got '{new string(cpuPodWeightBuffer)}' instead."); | ||
Throw.InvalidOperationException( | ||
$"Could not parse '{_cpuPodWeight}' content. Expected to find CPU weight but got '{new string(cpuPodWeightBuffer)}' instead."); | ||
RussKie marked this conversation as resolved.
Show resolved
Hide resolved
|
||
} | ||
|
||
_ = GetNextNumber(cpuPodWeightBuffer, out long cpuPodWeight); | ||
|
||
if (cpuPodWeight == -1) | ||
{ | ||
Throw.InvalidOperationException($"Could not parse '{_cpuPodWeight}'. Expected to get an integer but got: '{cpuPodWeight}'."); | ||
Throw.InvalidOperationException( | ||
$"Could not parse '{_cpuPodWeight}' content. Expected to get an integer but got: '{cpuPodWeightBuffer}'."); | ||
} | ||
|
||
// Calculate CPU pod request in millicores based on the weight, using the formula: | ||
// y = (1 + ((x - 2) * 9999) / 262142), where y is the CPU weight and x is the CPU share (cgroup v1) | ||
// https://github.com/kubernetes/enhancements/tree/master/keps/sig-node/2254-cgroup-v2#phase-1-convert-from-cgroups-v1-settings-to-v2 | ||
long cpuPodShare = ((cpuPodWeight * 262142) + 19997) / 9999; | ||
if (cpuPodShare == -1) | ||
if (cpuPodWeight < CpuPodWeightPossibleMin || cpuPodWeight > CpuPodWeightPossibleMax) | ||
{ | ||
Throw.InvalidOperationException($"Could not calculate CPU share from CPU weight '{cpuPodShare}'"); | ||
Throw.ArgumentOutOfRangeException("CPU weight", | ||
$"Expected to find CPU weight in range [{CpuPodWeightPossibleMin}-{CpuPodWeightPossibleMax}] in '{_cpuPodWeight}', but got '{cpuPodWeight}' instead."); | ||
RussKie marked this conversation as resolved.
Show resolved
Hide resolved
|
||
} | ||
|
||
cpuUnits = cpuPodShare; | ||
// The formula to calculate CPU pod weight (measured in millicores) from CPU share: | ||
// y = (1 + ((x - 2) * 9999) / 262142), | ||
// where y is the CPU pod weight (e.g. cpuPodWeight) and x is the CPU share of cgroup v1 (e.g. cpuUnits). | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Btw, since we're in V2 class, should the comment say "cgroup v2" too? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. CPU share is a setting from cgroups v1 only and it is not necessarily present in cgroups v2 files, though it might happen, so we are trying to take advantage of that and calculate CPU request based on the CPU share value (if it exists). |
||
// https://github.com/kubernetes/enhancements/tree/master/keps/sig-node/2254-cgroup-v2#phase-1-convert-from-cgroups-v1-settings-to-v2 | ||
// We invert the formula to calculate CPU share from CPU pod weight: | ||
#pragma warning disable S109 // Magic numbers should not be used - using the formula, forgive. | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. You can just extract local consts for the values then you can name them and eliminate the warnings. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. But I deliberately don't want to do that, prefer to use the formula as is because it is more readable :) |
||
cpuUnits = ((cpuPodWeight - 1) * 262142 / 9999) + 2; | ||
#pragma warning restore S109 // Magic numbers should not be used | ||
|
||
return true; | ||
} | ||
|
||
|
@@ -580,7 +590,7 @@ private long GetMemoryUsageInBytesPod() | |
if (memoryUsage == -1) | ||
{ | ||
Throw.InvalidOperationException( | ||
$"We tried to read '{_memoryUsageInBytes}', and we expected to get a positive number but instead it was: '{memoryUsage}'."); | ||
$"We tried to read '{_memoryUsageInBytes}', and we expected to get a positive number but instead it was: '{memoryUsageFile}'."); | ||
} | ||
|
||
return memoryUsage; | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
{ | ||
Type: InvalidOperationException, | ||
Message: Could not parse '/sys/fs/cgroup/cpuset.cpus.effective'. Expected comma-separated list of integers, with dashes ("-") based ranges ("0", "2-6,12") but got '@'., | ||
StackTrace: | ||
at Microsoft.Shared.Diagnostics.Throw.InvalidOperationException(String message) | ||
at Microsoft.Extensions.Diagnostics.ResourceMonitoring.Linux.LinuxUtilizationParserCgroupV2.<GetHostCpuCount>g__ThrowException|23_0(ReadOnlySpan`1 content) | ||
at Microsoft.Extensions.Diagnostics.ResourceMonitoring.Linux.LinuxUtilizationParserCgroupV2.GetHostCpuCount() | ||
at Microsoft.Extensions.Diagnostics.ResourceMonitoring.Linux.LinuxUtilizationParserCgroupV2.GetCgroupLimitedCpus() | ||
at Microsoft.Extensions.Diagnostics.ResourceMonitoring.Linux.Test.LinuxUtilizationParserCgroupV2Tests.<>c__DisplayClass15_0.<Fallsback_To_Cpuset_When_Quota_And_Period_Are_Minus_One_>b__0() | ||
at Xunit.Record.Exception(Func`1 testCode) | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
{ | ||
Type: InvalidOperationException, | ||
Message: Could not parse '/sys/fs/cgroup/memory.max' content. Expected to find available memory in bytes but got 'Suspicious12312312' instead., | ||
StackTrace: | ||
at Microsoft.Shared.Diagnostics.Throw.InvalidOperationException(String message) | ||
at Microsoft.Extensions.Diagnostics.ResourceMonitoring.Linux.LinuxUtilizationParserCgroupV2.GetAvailableMemoryInBytes() | ||
at Microsoft.Extensions.Diagnostics.ResourceMonitoring.Linux.Test.LinuxUtilizationParserCgroupV2Tests.<>c__DisplayClass6_0.<Throws_When_AvailableMemoryInBytes_Doesnt_Contain_Just_A_Number>b__0() | ||
at Xunit.Record.Exception(Func`1 testCode) | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
{ | ||
Type: InvalidOperationException, | ||
Message: Could not parse '/sys/fs/cgroup/memory.max' content. Expected to find available memory in bytes but got 'string12312' instead., | ||
StackTrace: | ||
at Microsoft.Shared.Diagnostics.Throw.InvalidOperationException(String message) | ||
at Microsoft.Extensions.Diagnostics.ResourceMonitoring.Linux.LinuxUtilizationParserCgroupV2.GetAvailableMemoryInBytes() | ||
at Microsoft.Extensions.Diagnostics.ResourceMonitoring.Linux.Test.LinuxUtilizationParserCgroupV2Tests.<>c__DisplayClass6_0.<Throws_When_AvailableMemoryInBytes_Doesnt_Contain_Just_A_Number>b__0() | ||
at Xunit.Record.Exception(Func`1 testCode) | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
{ | ||
Type: InvalidOperationException, | ||
Message: Could not parse '/sys/fs/cgroup/memory.max' content. Expected to find available memory in bytes but got 'string@' instead., | ||
StackTrace: | ||
at Microsoft.Shared.Diagnostics.Throw.InvalidOperationException(String message) | ||
at Microsoft.Extensions.Diagnostics.ResourceMonitoring.Linux.LinuxUtilizationParserCgroupV2.GetAvailableMemoryInBytes() | ||
at Microsoft.Extensions.Diagnostics.ResourceMonitoring.Linux.Test.LinuxUtilizationParserCgroupV2Tests.<>c__DisplayClass6_0.<Throws_When_AvailableMemoryInBytes_Doesnt_Contain_Just_A_Number>b__0() | ||
at Xunit.Record.Exception(Func`1 testCode) | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
{ | ||
Type: InvalidOperationException, | ||
Message: Could not parse '/sys/fs/cgroup/cpu.max'. Expected to get an integer but got: ' eeeee 12'., | ||
StackTrace: | ||
at Microsoft.Shared.Diagnostics.Throw.InvalidOperationException(String message) | ||
at Microsoft.Extensions.Diagnostics.ResourceMonitoring.Linux.LinuxUtilizationParserCgroupV2.TryGetCpuUnitsFromCgroups(IFileSystem fileSystem, Single& cpuUnits) | ||
at Microsoft.Extensions.Diagnostics.ResourceMonitoring.Linux.LinuxUtilizationParserCgroupV2.GetCgroupLimitedCpus() | ||
at Microsoft.Extensions.Diagnostics.ResourceMonitoring.Linux.Test.LinuxUtilizationParserCgroupV2Tests.<>c__DisplayClass16_0.<Throws_When_Cgroup_Cpu_Files_Contain_Invalid_Data>b__0() | ||
at Xunit.Record.Exception(Func`1 testCode) | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
{ | ||
Type: InvalidOperationException, | ||
Message: Could not parse '/sys/fs/cgroup/cpu.max'. Expected to get an integer but got: ''., | ||
StackTrace: | ||
at Microsoft.Shared.Diagnostics.Throw.InvalidOperationException(String message) | ||
at Microsoft.Extensions.Diagnostics.ResourceMonitoring.Linux.LinuxUtilizationParserCgroupV2.TryGetCpuUnitsFromCgroups(IFileSystem fileSystem, Single& cpuUnits) | ||
at Microsoft.Extensions.Diagnostics.ResourceMonitoring.Linux.LinuxUtilizationParserCgroupV2.GetCgroupLimitedCpus() | ||
at Microsoft.Extensions.Diagnostics.ResourceMonitoring.Linux.Test.LinuxUtilizationParserCgroupV2Tests.<>c__DisplayClass16_0.<Throws_When_Cgroup_Cpu_Files_Contain_Invalid_Data>b__0() | ||
at Xunit.Record.Exception(Func`1 testCode) | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
{ | ||
Type: InvalidOperationException, | ||
Message: Could not parse '/sys/fs/cgroup/cpu.max'. Expected an integer but got: '-18 18'., | ||
StackTrace: | ||
at Microsoft.Shared.Diagnostics.Throw.InvalidOperationException(String message) | ||
at Microsoft.Extensions.Diagnostics.ResourceMonitoring.Linux.LinuxUtilizationParserCgroupV2.TryGetCpuUnitsFromCgroups(IFileSystem fileSystem, Single& cpuUnits) | ||
at Microsoft.Extensions.Diagnostics.ResourceMonitoring.Linux.LinuxUtilizationParserCgroupV2.GetCgroupLimitedCpus() | ||
at Microsoft.Extensions.Diagnostics.ResourceMonitoring.Linux.Test.LinuxUtilizationParserCgroupV2Tests.<>c__DisplayClass16_0.<Throws_When_Cgroup_Cpu_Files_Contain_Invalid_Data>b__0() | ||
at Xunit.Record.Exception(Func`1 testCode) | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
{ | ||
Type: InvalidOperationException, | ||
Message: Could not parse '/sys/fs/cgroup/cpu.max'. Expected an integer but got: '- d''., | ||
StackTrace: | ||
at Microsoft.Shared.Diagnostics.Throw.InvalidOperationException(String message) | ||
at Microsoft.Extensions.Diagnostics.ResourceMonitoring.Linux.LinuxUtilizationParserCgroupV2.TryGetCpuUnitsFromCgroups(IFileSystem fileSystem, Single& cpuUnits) | ||
at Microsoft.Extensions.Diagnostics.ResourceMonitoring.Linux.LinuxUtilizationParserCgroupV2.GetCgroupLimitedCpus() | ||
at Microsoft.Extensions.Diagnostics.ResourceMonitoring.Linux.Test.LinuxUtilizationParserCgroupV2Tests.<>c__DisplayClass16_0.<Throws_When_Cgroup_Cpu_Files_Contain_Invalid_Data>b__0() | ||
at Xunit.Record.Exception(Func`1 testCode) | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
{ | ||
Type: InvalidOperationException, | ||
Message: Could not parse '/sys/fs/cgroup/cpu.max'. Expected an integer but got: '- d/:'., | ||
StackTrace: | ||
at Microsoft.Shared.Diagnostics.Throw.InvalidOperationException(String message) | ||
at Microsoft.Extensions.Diagnostics.ResourceMonitoring.Linux.LinuxUtilizationParserCgroupV2.TryGetCpuUnitsFromCgroups(IFileSystem fileSystem, Single& cpuUnits) | ||
at Microsoft.Extensions.Diagnostics.ResourceMonitoring.Linux.LinuxUtilizationParserCgroupV2.GetCgroupLimitedCpus() | ||
at Microsoft.Extensions.Diagnostics.ResourceMonitoring.Linux.Test.LinuxUtilizationParserCgroupV2Tests.<>c__DisplayClass16_0.<Throws_When_Cgroup_Cpu_Files_Contain_Invalid_Data>b__0() | ||
at Xunit.Record.Exception(Func`1 testCode) | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
{ | ||
Type: InvalidOperationException, | ||
Message: Could not parse '/sys/fs/cgroup/cpu.max'. Expected to get an integer but got: ' '., | ||
StackTrace: | ||
at Microsoft.Shared.Diagnostics.Throw.InvalidOperationException(String message) | ||
at Microsoft.Extensions.Diagnostics.ResourceMonitoring.Linux.LinuxUtilizationParserCgroupV2.TryGetCpuUnitsFromCgroups(IFileSystem fileSystem, Single& cpuUnits) | ||
at Microsoft.Extensions.Diagnostics.ResourceMonitoring.Linux.LinuxUtilizationParserCgroupV2.GetCgroupLimitedCpus() | ||
at Microsoft.Extensions.Diagnostics.ResourceMonitoring.Linux.Test.LinuxUtilizationParserCgroupV2Tests.<>c__DisplayClass16_0.<Throws_When_Cgroup_Cpu_Files_Contain_Invalid_Data>b__0() | ||
at Xunit.Record.Exception(Func`1 testCode) | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
{ | ||
Type: InvalidOperationException, | ||
Message: | ||
Could not parse '/sys/fs/cgroup/cpu.max'. Expected to get an integer but got: ' | ||
|
||
|
||
|
||
|
||
'., | ||
StackTrace: | ||
at Microsoft.Shared.Diagnostics.Throw.InvalidOperationException(String message) | ||
at Microsoft.Extensions.Diagnostics.ResourceMonitoring.Linux.LinuxUtilizationParserCgroupV2.TryGetCpuUnitsFromCgroups(IFileSystem fileSystem, Single& cpuUnits) | ||
at Microsoft.Extensions.Diagnostics.ResourceMonitoring.Linux.LinuxUtilizationParserCgroupV2.GetCgroupLimitedCpus() | ||
at Microsoft.Extensions.Diagnostics.ResourceMonitoring.Linux.Test.LinuxUtilizationParserCgroupV2Tests.<>c__DisplayClass16_0.<Throws_When_Cgroup_Cpu_Files_Contain_Invalid_Data>b__0() | ||
at Xunit.Record.Exception(Func`1 testCode) | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
{ | ||
Type: InvalidOperationException, | ||
Message: Could not parse '/sys/fs/cgroup/cpu.max'. Expected to get an integer but got: ' d/:'., | ||
StackTrace: | ||
at Microsoft.Shared.Diagnostics.Throw.InvalidOperationException(String message) | ||
at Microsoft.Extensions.Diagnostics.ResourceMonitoring.Linux.LinuxUtilizationParserCgroupV2.TryGetCpuUnitsFromCgroups(IFileSystem fileSystem, Single& cpuUnits) | ||
at Microsoft.Extensions.Diagnostics.ResourceMonitoring.Linux.LinuxUtilizationParserCgroupV2.GetCgroupLimitedCpus() | ||
at Microsoft.Extensions.Diagnostics.ResourceMonitoring.Linux.Test.LinuxUtilizationParserCgroupV2Tests.<>c__DisplayClass16_0.<Throws_When_Cgroup_Cpu_Files_Contain_Invalid_Data>b__0() | ||
at Xunit.Record.Exception(Func`1 testCode) | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
{ | ||
Type: InvalidOperationException, | ||
Message: Could not parse '/sys/fs/cgroup/cpu.max'. Expected to get an integer but got: 'd2d2d e3'., | ||
StackTrace: | ||
at Microsoft.Shared.Diagnostics.Throw.InvalidOperationException(String message) | ||
at Microsoft.Extensions.Diagnostics.ResourceMonitoring.Linux.LinuxUtilizationParserCgroupV2.TryGetCpuUnitsFromCgroups(IFileSystem fileSystem, Single& cpuUnits) | ||
at Microsoft.Extensions.Diagnostics.ResourceMonitoring.Linux.LinuxUtilizationParserCgroupV2.GetCgroupLimitedCpus() | ||
at Microsoft.Extensions.Diagnostics.ResourceMonitoring.Linux.Test.LinuxUtilizationParserCgroupV2Tests.<>c__DisplayClass16_0.<Throws_When_Cgroup_Cpu_Files_Contain_Invalid_Data>b__0() | ||
at Xunit.Record.Exception(Func`1 testCode) | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
{ | ||
Type: InvalidOperationException, | ||
Message: Could not parse '/sys/fs/cgroup/cpu.max'. Expected to get an integer but got: 'd d3'., | ||
StackTrace: | ||
at Microsoft.Shared.Diagnostics.Throw.InvalidOperationException(String message) | ||
at Microsoft.Extensions.Diagnostics.ResourceMonitoring.Linux.LinuxUtilizationParserCgroupV2.TryGetCpuUnitsFromCgroups(IFileSystem fileSystem, Single& cpuUnits) | ||
at Microsoft.Extensions.Diagnostics.ResourceMonitoring.Linux.LinuxUtilizationParserCgroupV2.GetCgroupLimitedCpus() | ||
at Microsoft.Extensions.Diagnostics.ResourceMonitoring.Linux.Test.LinuxUtilizationParserCgroupV2Tests.<>c__DisplayClass16_0.<Throws_When_Cgroup_Cpu_Files_Contain_Invalid_Data>b__0() | ||
at Xunit.Record.Exception(Func`1 testCode) | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
{ | ||
Type: InvalidOperationException, | ||
Message: Could not parse '/sys/fs/cgroup/cpu.max'. Expected an integer but got: 'dd1d 18'., | ||
StackTrace: | ||
at Microsoft.Shared.Diagnostics.Throw.InvalidOperationException(String message) | ||
at Microsoft.Extensions.Diagnostics.ResourceMonitoring.Linux.LinuxUtilizationParserCgroupV2.TryGetCpuUnitsFromCgroups(IFileSystem fileSystem, Single& cpuUnits) | ||
at Microsoft.Extensions.Diagnostics.ResourceMonitoring.Linux.LinuxUtilizationParserCgroupV2.GetCgroupLimitedCpus() | ||
at Microsoft.Extensions.Diagnostics.ResourceMonitoring.Linux.Test.LinuxUtilizationParserCgroupV2Tests.<>c__DisplayClass16_0.<Throws_When_Cgroup_Cpu_Files_Contain_Invalid_Data>b__0() | ||
at Xunit.Record.Exception(Func`1 testCode) | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
{ | ||
Type: InvalidOperationException, | ||
Message: Could not parse '/sys/fs/cgroup/cpu.weight' content. Expected to find CPU weight but got '-1' instead., | ||
StackTrace: | ||
at Microsoft.Shared.Diagnostics.Throw.InvalidOperationException(String message) | ||
at Microsoft.Extensions.Diagnostics.ResourceMonitoring.Linux.LinuxUtilizationParserCgroupV2.TryGetCgroupRequestCpu(IFileSystem fileSystem, Single& cpuUnits) | ||
at Microsoft.Extensions.Diagnostics.ResourceMonitoring.Linux.LinuxUtilizationParserCgroupV2.GetCgroupRequestCpu() | ||
at Microsoft.Extensions.Diagnostics.ResourceMonitoring.Linux.Test.LinuxUtilizationParserCgroupV2Tests.<>c__DisplayClass22_0.<Throws_When_Cgroup_Cpu_Weight_Files_Contain_Invalid_Data>b__0() | ||
at Xunit.Record.Exception(Func`1 testCode) | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
{ | ||
Type: ArgumentOutOfRangeException, | ||
Message: Expected to find CPU weight in range [1-10000] in '/sys/fs/cgroup/cpu.weight', but got '0' instead. (Parameter 'CPU weight'), | ||
ParamName: CPU weight, | ||
StackTrace: | ||
at Microsoft.Shared.Diagnostics.Throw.ArgumentOutOfRangeException(String paramName, String message) | ||
at Microsoft.Extensions.Diagnostics.ResourceMonitoring.Linux.LinuxUtilizationParserCgroupV2.TryGetCgroupRequestCpu(IFileSystem fileSystem, Single& cpuUnits) | ||
at Microsoft.Extensions.Diagnostics.ResourceMonitoring.Linux.LinuxUtilizationParserCgroupV2.GetCgroupRequestCpu() | ||
at Microsoft.Extensions.Diagnostics.ResourceMonitoring.Linux.Test.LinuxUtilizationParserCgroupV2Tests.<>c__DisplayClass22_0.<Throws_When_Cgroup_Cpu_Weight_Files_Contain_Invalid_Data>b__0() | ||
at Xunit.Record.Exception(Func`1 testCode) | ||
} |
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.
@evgenyfedorov2 I am being curious here, pod, for me is a K8s concept and as far as I understand this parser will calculate the utilization of resources on a cgroup on a container regardless of the use of k8s or not.
In the future would it be worth it to rename pod to container to not confuse that this class and logic is not K8s exclussive?