Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Add memory usage metric#6586

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 ourterms of service andprivacy statement. We’ll occasionally send you account related emails.

Already on GitHub?Sign in to your account

Conversation

@evgenyfedorov2
Copy link
Member

@evgenyfedorov2evgenyfedorov2 commentedJul 8, 2025
edited
Loading

Fixes#6587

Microsoft Reviewers:Open in CodeFlow

Addingcontainer.memory.usage metric withObservableUpDownCounter instrument type, measured in bytes.

@evgenyfedorov2evgenyfedorov2force-pushed theusers/evgenyfedorov2/add_memory_usage_metric branch from6989b03 tod671e88CompareJuly 9, 2025 06:06
@evgenyfedorov2evgenyfedorov2 marked this pull request as ready for reviewJuly 9, 2025 07:04
CopilotAI review requested due to automatic review settingsJuly 9, 2025 07:04
@evgenyfedorov2evgenyfedorov2 requested review froma team ascode ownersJuly 9, 2025 07:04

This comment was marked as outdated.

@evgenyfedorov2evgenyfedorov2force-pushed theusers/evgenyfedorov2/add_memory_usage_metric branch from9779fd3 todd6b70fCompareJuly 9, 2025 07:12

This comment was marked as outdated.

@evgenyfedorov2evgenyfedorov2force-pushed theusers/evgenyfedorov2/add_memory_usage_metric branch 2 times, most recently fromac948f7 to120a012CompareJuly 9, 2025 08:03

This comment was marked as outdated.

This comment was marked as outdated.

@evgenyfedorov2evgenyfedorov2force-pushed theusers/evgenyfedorov2/add_memory_usage_metric branch from2b4b3ed to66a792dCompareJuly 9, 2025 08:16
@evgenyfedorov2evgenyfedorov2force-pushed theusers/evgenyfedorov2/add_memory_usage_metric branch from66a792d toe06592fCompareJuly 9, 2025 08:38

This comment was marked as outdated.

@evgenyfedorov2evgenyfedorov2force-pushed theusers/evgenyfedorov2/add_memory_usage_metric branch frome06592f to244d332CompareJuly 9, 2025 09:50
@evgenyfedorov2evgenyfedorov2force-pushed theusers/evgenyfedorov2/add_memory_usage_metric branch from244d332 to412064aCompareJuly 9, 2025 11:26

This comment was marked as outdated.

@dotnet-policy-servicedotnet-policy-servicebot added the waiting-author-feedback 📭The author of this issue needs to respond in order for us to continue investigating this issue. labelJul 11, 2025
@dotnet-policy-servicedotnet-policy-servicebot removed the waiting-author-feedback 📭The author of this issue needs to respond in order for us to continue investigating this issue. labelJul 11, 2025
Copy link
Contributor

CopilotAI 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

Adds a newcontainer.memory.usage metric (bytes) as an ObservableUpDownCounter across Windows and Linux, updates logging, and extends tests to validate the new instrument.

  • IntroduceContainerMemoryUsage constant and register it in both Windows and Linux providers.
  • Refactor snapshot providers to expose container memory usage and separate percentage calculations, updating log messages.
  • Extend unit and acceptance tests to subscribe to and assert on the new memory‐usage metric.

Reviewed Changes

Copilot reviewed 10 out of 10 changed files in this pull request and generated 2 comments.

Show a summary per file
FileDescription
test/.../Windows/WindowsContainerSnapshotProviderTests.csAdded tests for combined container/process memory metrics and standalone usage test
test/.../Linux/LinuxUtilizationProviderTests.csCapturedContainerMemoryUsage in measurements, updated expected sample/retry counts
test/.../Linux/AcceptanceTest.csSubscribed to and asserted on new container memory usage gauge
test/.../ResourceUtilizationHealthChecks/ResourceHealthCheckExtensionsTests.csAddedGetCurrentProcessMemoryUsage setup for health‐check tests
src/Shared/Instruments/ResourceUtilizationInstruments.csAddedpublic const string ContainerMemoryUsage constant with XML docs
src/Libraries/.../Windows/WindowsSnapshotProvider.csRefactored memory methods, added_processMemoryLocker, new up/down counter, log rename
src/Libraries/.../Windows/Log.csAddedContainerMemoryUsageData andProcessMemoryPercentageData messages
src/Libraries/.../Linux/Log.csRenamedMemoryUsageData toMemoryPercentageData, added newMemoryUsageData
src/Libraries/.../Linux/LinuxUtilizationProvider.csRefactored memory methods, added up/down counter for usage, updated retry helper
Comments suppressed due to low confidence (2)

src/Libraries/Microsoft.Extensions.Diagnostics.ResourceMonitoring/Windows/WindowsContainerSnapshotProvider.cs:234

  • Logging while holding the _memoryLocker can lead to lock contention or unexpected delays. It’s safer to capture the values inside the lock and invoke the logger after releasing the lock to minimize the duration of the critical section.
                _logger.ProcessMemoryPercentageData(processMemoryUsage, _memoryLimit, _processMemoryPercentage);

src/Libraries/Microsoft.Extensions.Diagnostics.ResourceMonitoring/Windows/Log.cs:69

  • ThetotalMemory parameter represents a byte count but is typed asdouble. For consistency withprocessMemoryUsage and to avoid implicit conversions, consider changingtotalMemory toulong.
        double memoryPercentage);

Sign up for freeto subscribe to this conversation on GitHub. Already have an account?Sign in.

Reviewers

Copilot code reviewCopilotCopilot left review comments

@mariamgergesmariamgergesmariamgerges approved these changes

@amadeuszlamadeuszlamadeuszl approved these changes

Assignees

@evgenyfedorov2evgenyfedorov2

Projects

None yet

Milestone

No milestone

Development

Successfully merging this pull request may close these issues.

Add a metric for memory usage to Resource Monitoring

3 participants

@evgenyfedorov2@mariamgerges@amadeuszl

[8]ページ先頭

©2009-2025 Movatter.jp