[v2] Add Diagnostics Metrics Tracking to MAUI Applications#31049
Closed
[v2] Add Diagnostics Metrics Tracking to MAUI Applications#31049
Conversation
Contributor
There was a problem hiding this comment.
Pull Request Overview
This PR adds basic diagnostics metrics tracking to MAUI applications by introducing meter support for layout performance monitoring. The implementation provides infrastructure to track measure and arrange operations with counters and histograms.
Key changes:
- Adds meter support feature flag and diagnostics infrastructure
- Implements metrics tracking for layout operations (measure/arrange)
- Integrates diagnostics into the core MAUI application builder
Reviewed Changes
Copilot reviewed 6 out of 6 changed files in this pull request and generated 4 comments.
Show a summary per file
| File | Description |
|---|---|
src/Core/src/RuntimeFeature.cs |
Adds IsMeterSupported feature flag with default true value |
src/Core/src/Hosting/MauiAppBuilder.cs |
Integrates diagnostics configuration into default MAUI app setup |
src/Core/src/Diagnostics/MauiDiagnostics.cs |
Core diagnostics implementation with ActivitySource, meters, and extension methods |
src/Controls/src/Core/VisualElement/VisualElement.cs |
Adds metrics tracking to measure and arrange operations |
src/Controls/src/Core/Diagnostics/MetricsTracker.cs |
Disposable tracker for recording layout operation metrics with activity management |
src/Controls/samples/Controls.Sample/MauiProgram.cs |
Sample configuration showing how to consume diagnostics metrics and activities |
Comments suppressed due to low confidence (3)
jonathanpeppers
previously approved these changes
Aug 6, 2025
Comment on lines
+76
to
+80
| #if NET9_0_OR_GREATER | ||
| diag?.MeasureHistogram?.Record((int)duration.Value.TotalNanoseconds); | ||
| #else | ||
| diag?.MeasureHistogram?.Record((int)(duration.Value.TotalMilliseconds * 1_000_000)); | ||
| #endif |
Member
There was a problem hiding this comment.
I guess this was introduced in .NET 7:
But I don't see how this code would compile to net7.0 anyway, so don't need to fix really.
8b027be to
258c83e
Compare
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 subscribe to this conversation on GitHub.
Already have an account?
Sign in.
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.
Description of Change
Simplified down version of #30130 to just add the basics for wiring into a MeasureFactory.
Issues Fixed
Fixes #28091