Skip to content

Conversation

PureWeen
Copy link
Member

@PureWeen PureWeen commented Aug 6, 2025

Description of Change

Simplified down version of #30130 to just add the basics for wiring into a MeasureFactory.

Issues Fixed

Fixes #28091

@Copilot Copilot AI review requested due to automatic review settings August 6, 2025 19:31
@PureWeen PureWeen requested a review from a team as a code owner August 6, 2025 19:31
Copy link
Contributor

@Copilot 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 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
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
Copy link
Member

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:

https://learn.microsoft.com/en-us/dotnet/api/system.timespan.nanoseconds?view=net-9.0&viewFallbackFrom=net-6.0

But I don't see how this code would compile to net7.0 anyway, so don't need to fix really.

@PureWeen PureWeen added this to the .NET 10.0-rc1 milestone Aug 6, 2025
@PureWeen PureWeen moved this from Todo to Approved in MAUI SDK Ongoing Aug 6, 2025
@mattleibow mattleibow changed the title Add diagnostics metrics tracking to Maui application Add Diagnostics Metrics Tracking to MAUI Applications Aug 7, 2025
@mattleibow mattleibow changed the title Add Diagnostics Metrics Tracking to MAUI Applications [v2] Add Diagnostics Metrics Tracking to MAUI Applications Aug 7, 2025
@PureWeen PureWeen closed this Aug 7, 2025
@github-project-automation github-project-automation bot moved this from Approved to Done in MAUI SDK Ongoing Aug 7, 2025
@github-actions github-actions bot locked and limited conversation to collaborators Sep 7, 2025
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

2 participants