Description
Description
when I ran this code in cosmic, the resource I got is for the VM instead of the Pod. I tried both latest version of IResourceUtilizationTracker and IResourceMonitor.
what I got is like this:
L:Information | Resource Monitoring is running inside a Job Object. For more information about Job Objects see
https://aka.ms/job-objects
L:Debug | System resources information: CpuLimit = 32, CpuRequest = 32, MemoryLimit = 137438482432, MemoryRequest = 137438482432.
but actually, our configuration for Pod in cosmic is: CPU limit = 5, and MemoryRequest is 28Gi.
For met, this package does not work at all. Or anything I am missing? please help to check.
Reproduction Steps
My code:
-
register service:
serviceCollection.AddResourceMonitoring(builder =>
builder.ConfigureMonitor(options =>
{
options.CpuConsumptionRefreshInterval = TimeSpan.FromSeconds(30);
options.MemoryConsumptionRefreshInterval = TimeSpan.FromSeconds(30);
options.SamplingInterval = TimeSpan.FromSeconds(10);
options.CollectionWindow = TimeSpan.FromSeconds(600);
})); -
get utilization:
IResourceMonitor monitor = Hosting.HostInstance.Services.GetService();
return monitor?.GetUtilization(TimeSpan.FromMinutes(5));
Expected behavior
expected: CpuLimit = 5, CpuRequest = 5, MemoryLimit = 28G, MemoryRequest = 28G
Actual behavior
CpuLimit = 32, CpuRequest = 32, MemoryLimit = 137438482432, MemoryRequest = 137438482432
Regression?
No response
Known Workarounds
No response
Configuration
No response
Other information
No response
Activity
RussKie commentedon Oct 10, 2024
@mobratil @evgenyfedorov2 could you please investigate?
evgenyfedorov2 commentedon Oct 10, 2024
Discussing internally
evgenyfedorov2 commentedon Feb 5, 2025
Closing because unable to reproduce and nobody else reported this bug too. Possible reason - target machine(-s) has very specific CPU configuration