Skip to content
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

Incorrect metric names in ResourceUtilizationInstruments #5113

Closed
evgenyfedorov2 opened this issue Apr 17, 2024 · 0 comments · Fixed by #5341
Closed

Incorrect metric names in ResourceUtilizationInstruments #5113

evgenyfedorov2 opened this issue Apr 17, 2024 · 0 comments · Fixed by #5341
Assignees
Labels
area-fundamentals bug This issue describes a behavior which is not expected - a bug. work in progress 🚧

Comments

@evgenyfedorov2
Copy link
Contributor

Metric names in ResourceUtilizationInstruments have incorrect keys https://github.com/dotnet/extensions/blob/10681a1cdb1e044b05341150203b94d5eec41557/src/Libraries/Microsoft.Extensions.Diagnostics.ResourceMonitoring/ResourceUtilizationInstruments.cs

  1. public const string CpuUtilization = "process.cpu.utilization"; - in reality, the CPU utilization is measured for all processes in a container, not only for current.
  2. public const string MemoryUtilization = "dotnet.process.memory.virtual.utilization";- in reality, the Memory utilization is measured for all processes in a container, not only for current dotnet process.
@geeknoid geeknoid added bug This issue describes a behavior which is not expected - a bug. and removed untriaged labels May 31, 2024
joperezr added a commit to joperezr/extensions that referenced this issue Aug 15, 2024
…ng (dotnet#5341)

Add metrics with correct names for Resource Monitoring (dotnet#5341)

Fixes dotnet#5113
Previous art: dotnet#5309

Add new metrics with correct names. Old metrics will continue to be enabled by default.

### Existing metric setup

**Windows Snapshot provider class**
    `process.cpu.utilization`
    `dotnet.process.memory.virtual.utilization`

**Windows Container Snapshot provider class**
    `process.cpu.utilization`
    `dotnet.process.memory.virtual.utilization`

**Linix Utilization Provider class**
    `process.cpu.utilization`
    `dotnet.process.memory.virtual.utilization`

### New metric setup

**Windows Snapshot provider class**
    `process.cpu.utilization` - no changes
    `dotnet.process.memory.virtual.utilization` - no changes

**Windows Container Snapshot provider class**
    `process.cpu.utilization` - no changes
    `dotnet.process.memory.virtual.utilization` - calculates memory for the dotnet process only (instead of all processes)
    `container.cpu.limit.utilization` - new metric, same value as `process.cpu.utilization`
    `container.memory.limit.utilization` - new metric, calculates memory for all processes in the container

**Linux Utilization Provider class**
    `process.cpu.utilization` - fixed incorrect scale calculation, instead of `host CPUs / CPU limit / CPU request`, it is now `host CPUs / CPU request`
    `dotnet.process.memory.virtual.utilization` - no changes
    `container.cpu.limit.utilization` - new metric, value is relative to CPU resource limit (aka maximum CPU units)
    `container.memory.limit.utilization` - new metric, calculates memory for all processes in the container
    `container.cpu.request.utilization` - new metric, same value as `process.cpu.utilization`

----
#### AI description  (iteration 1)
#### PR Classification
New feature: Added metrics with correct names for resource monitoring.

#### PR Summary
This pull request introduces new metrics for resource monitoring with correct naming conventions and updates the related tests and implementation.
- `LinuxUtilizationProvider.cs`: Added new metrics for container CPU and memory utilization, and updated existing metrics.
- `AcceptanceTest.cs`: Added new tests for verifying the new metrics and updated existing tests for better coverage.
- `ResourceUtilizationInstruments.cs`: Defined new constants for the new metrics.
- Removed `WindowsCounters.cs` as it is no longer needed.
@github-actions github-actions bot locked and limited conversation to collaborators Sep 12, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
area-fundamentals bug This issue describes a behavior which is not expected - a bug. work in progress 🚧
Projects
None yet
2 participants