-
Notifications
You must be signed in to change notification settings - Fork 10.5k
Open
Labels
area-blazorIncludes: Blazor, Razor ComponentsIncludes: Blazor, Razor ComponentsenhancementThis issue represents an ask for new feature or an enhancement to an existing oneThis issue represents an ask for new feature or an enhancement to an existing one
Milestone
Description
Summary
Consider enabling MetricsSupport and EventSourceSupport MSBuild properties by default for Blazor WebAssembly projects to support OpenTelemetry metrics instrumentation out of the box.
Background
Currently, to enable OpenTelemetry metrics in Blazor WebAssembly, developers must manually add MSBuild properties to their .csproj:
<PropertyGroup>
<!-- Enable WebAssembly diagnostics for OpenTelemetry metrics -->
<!-- See: https://learn.microsoft.com/aspnet/core/blazor/performance/webassembly-event-pipe-diagnostics -->
<MetricsSupport>true</MetricsSupport>
<EventSourceSupport>true</EventSourceSupport>
</PropertyGroup>Without these properties, runtime instrumentation and metrics don't work in WebAssembly, making Aspire integration incomplete.
Proposal
Consider enabling these properties by default in the Blazor WebAssembly SDK, similar to how other diagnostic features are enabled by default in ASP.NET Core projects.
Options
- Enable by default for all WASM projects - Simplest, but may have size/performance implications
- Enable by default when OpenTelemetry packages are referenced - Conditional enablement
- Enable by default in Aspire-integrated projects - Scoped to Aspire scenarios only
Considerations
- App size impact: These properties may increase the final WASM bundle size
- Performance: Need to measure any runtime overhead
- Discoverability: Currently, developers often don't know these are required until metrics don't work
Documentation
Related Issues
- Support hosted services in WebAssemblyHost #63637 - IHostedService support in WebAssembly
Part of .NET 11.0 Blazor + Aspire integration improvements
Metadata
Metadata
Assignees
Labels
area-blazorIncludes: Blazor, Razor ComponentsIncludes: Blazor, Razor ComponentsenhancementThis issue represents an ask for new feature or an enhancement to an existing oneThis issue represents an ask for new feature or an enhancement to an existing one