Skip to content

Add scaling to [0, 100] for LinuxUtilizationProvider#7289

Merged
amadeuszl merged 7 commits intodotnet:mainfrom
amadeuszl:users/alechniak/fix-0-100-linux-utilization
Feb 24, 2026
Merged

Add scaling to [0, 100] for LinuxUtilizationProvider#7289
amadeuszl merged 7 commits intodotnet:mainfrom
amadeuszl:users/alechniak/fix-0-100-linux-utilization

Conversation

@amadeuszl
Copy link
Contributor

@amadeuszl amadeuszl commented Feb 12, 2026

Fix #7124

Microsoft Reviewers: Open in CodeFlow

@amadeuszl amadeuszl requested a review from a team as a code owner February 12, 2026 12:26
Copilot AI review requested due to automatic review settings February 12, 2026 12:26
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR addresses #7124 by adding a Linux-specific option to emit CPU/memory utilization metrics either as ratios ([0,1]) or as percentage-like values ([0,100]) to support exporters that don’t handle fractional values well.

Changes:

  • Added ResourceMonitoringOptions.UseZeroToOneRangeForLinuxMetrics (defaulting to [0,1] behavior).
  • Updated LinuxUtilizationProvider to apply a configurable multiplier (1 or 100) to Linux CPU and memory utilization metric calculations.
  • Added Linux utilization provider tests to validate the new scaling behavior (currently focused on memory utilization).

Reviewed changes

Copilot reviewed 3 out of 3 changed files in this pull request and generated 5 comments.

File Description
test/Libraries/Microsoft.Extensions.Diagnostics.ResourceMonitoring.Tests/Linux/LinuxUtilizationProviderTests.cs Adds tests for the new Linux scaling option (memory utilization assertions).
src/Libraries/Microsoft.Extensions.Diagnostics.ResourceMonitoring/ResourceMonitoringOptions.cs Introduces the new Linux-specific scaling option with XML docs.
src/Libraries/Microsoft.Extensions.Diagnostics.ResourceMonitoring/Linux/LinuxUtilizationProvider.cs Applies the scaling option to CPU/memory utilization metric calculations via a multiplier.

# Conflicts:
#	test/Libraries/Microsoft.Extensions.Diagnostics.ResourceMonitoring.Tests/Linux/AcceptanceTest.cs
Copy link
Contributor

@rafal-mz rafal-mz left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@amadeuszl amadeuszl merged commit 9f24aa0 into dotnet:main Feb 24, 2026
6 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Linux Resource Monitoring has no option to emit values [0,100]

4 participants