extensions icon indicating copy to clipboard operation
extensions copied to clipboard

ResourceUtilization is for VM instead of POD in cosmic

Open guoqiangzhou opened this issue 1 year ago • 2 comments

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:

  1. 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); }));

  2. get utilization: IResourceMonitor monitor = Hosting.HostInstance.Services.GetService<IResourceMonitor>(); 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

guoqiangzhou avatar Oct 09 '24 17:10 guoqiangzhou

@mobratil @evgenyfedorov2 could you please investigate?

RussKie avatar Oct 10 '24 06:10 RussKie

Discussing internally

evgenyfedorov2 avatar Oct 10 '24 14:10 evgenyfedorov2

Closing because unable to reproduce and nobody else reported this bug too. Possible reason - target machine(-s) has very specific CPU configuration

evgenyfedorov2 avatar Feb 05 '25 15:02 evgenyfedorov2