-
Notifications
You must be signed in to change notification settings - Fork 1.9k
[v2] Add Diagnostics Metrics Tracking to MAUI Applications #31049
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
Conversation
There was a problem hiding this 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 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)
#if NET9_0_OR_GREATER | ||
diag?.MeasureHistogram?.Record((int)duration.Value.TotalNanoseconds); | ||
#else | ||
diag?.MeasureHistogram?.Record((int)(duration.Value.TotalMilliseconds * 1_000_000)); | ||
#endif |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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
Description of Change
Simplified down version of #30130 to just add the basics for wiring into a MeasureFactory.
Issues Fixed
Fixes #28091