Add scaling to [0, 100] for LinuxUtilizationProvider#7289
Merged
amadeuszl merged 7 commits intodotnet:mainfrom Feb 24, 2026
Merged
Add scaling to [0, 100] for LinuxUtilizationProvider#7289amadeuszl merged 7 commits intodotnet:mainfrom
amadeuszl merged 7 commits intodotnet:mainfrom
Conversation
Contributor
There was a problem hiding this comment.
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
LinuxUtilizationProviderto 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. |
...osoft.Extensions.Diagnostics.ResourceMonitoring.Tests/Linux/LinuxUtilizationProviderTests.cs
Show resolved
Hide resolved
...osoft.Extensions.Diagnostics.ResourceMonitoring.Tests/Linux/LinuxUtilizationProviderTests.cs
Show resolved
Hide resolved
...osoft.Extensions.Diagnostics.ResourceMonitoring.Tests/Linux/LinuxUtilizationProviderTests.cs
Show resolved
Hide resolved
...osoft.Extensions.Diagnostics.ResourceMonitoring.Tests/Linux/LinuxUtilizationProviderTests.cs
Show resolved
Hide resolved
src/Libraries/Microsoft.Extensions.Diagnostics.ResourceMonitoring/ResourceMonitoringOptions.cs
Show resolved
Hide resolved
amadeuszl
commented
Feb 13, 2026
src/Libraries/Microsoft.Extensions.Diagnostics.ResourceMonitoring/ResourceMonitoringOptions.cs
Show resolved
Hide resolved
# Conflicts: # test/Libraries/Microsoft.Extensions.Diagnostics.ResourceMonitoring.Tests/Linux/AcceptanceTest.cs
evgenyfedorov2
approved these changes
Feb 24, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fix #7124
Microsoft Reviewers: Open in CodeFlow