Skip to content

ResourceUtilization is for VM instead of POD in cosmic #5495

Not planned
@guoqiangzhou

Description

@guoqiangzhou

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();
    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

added
bugThis issue describes a behavior which is not expected - a bug.
on Oct 9, 2024
RussKie

RussKie commented on Oct 10, 2024

@RussKie
Member

@mobratil @evgenyfedorov2 could you please investigate?

evgenyfedorov2

evgenyfedorov2 commented on Oct 10, 2024

@evgenyfedorov2
Contributor

Discussing internally

evgenyfedorov2

evgenyfedorov2 commented on Feb 5, 2025

@evgenyfedorov2
Contributor

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

locked and limited conversation to collaborators on Mar 8, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Labels

area-resourcemonitoringbugThis issue describes a behavior which is not expected - a bug.

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions

    ResourceUtilization is for VM instead of POD in cosmic · Issue #5495 · dotnet/extensions