Skip to content
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
OpenTelemetry.Instrumentation.AspNetCore.AspNetCoreTraceInstrumentationOptions.EnableBlazorSupport.get -> bool
OpenTelemetry.Instrumentation.AspNetCore.AspNetCoreTraceInstrumentationOptions.EnableBlazorSupport.set -> void
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Personally I prefer this shorter name, but asking as I had the thought on the other PR, should this instead be EnableAspNetCoreBlazorSupport for consistency with the other property names?

Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,13 @@ internal static MeterProviderBuilder ConfigureMeters(this MeterProviderBuilder b
.AddMeter("Microsoft.AspNetCore.Http.Connections")
.AddMeter("Microsoft.AspNetCore.Routing")
.AddMeter("Microsoft.AspNetCore.Diagnostics")
.AddMeter("Microsoft.AspNetCore.RateLimiting");
.AddMeter("Microsoft.AspNetCore.RateLimiting")
.AddMeter("Microsoft.AspNetCore.Components")
.AddMeter("Microsoft.AspNetCore.Components.Server.Circuits")
.AddMeter("Microsoft.AspNetCore.Components.Lifecycle")
.AddMeter("Microsoft.AspNetCore.Authorization")
.AddMeter("Microsoft.AspNetCore.Authentication")
.AddMeter("Microsoft.AspNetCore.Identity")
.AddMeter("Microsoft.AspNetCore.MemoryPool");
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -126,15 +126,26 @@ private static void AddAspNetCoreInstrumentationSources(
builder.AddLegacySource(HttpInListener.ActivityOperationName); // for the activities created by AspNetCore
}

var options = serviceProvider?.GetRequiredService<IOptionsMonitor<AspNetCoreTraceInstrumentationOptions>>().Get(optionsName);

// SignalR activities first added in .NET 9.0
if (Environment.Version.Major >= 9)
{
var options = serviceProvider?.GetRequiredService<IOptionsMonitor<AspNetCoreTraceInstrumentationOptions>>().Get(optionsName);
if (options is null || options.EnableAspNetCoreSignalRSupport)
{
// https://github.com/dotnet/aspnetcore/blob/6ae3ea387b20f6497b82897d613e9b8a6e31d69c/src/SignalR/server/Core/src/Internal/SignalRServerActivitySource.cs#L13C35-L13C70
builder.AddSource("Microsoft.AspNetCore.SignalR.Server");
}
}

// Blazor activities first added in .NET 10.0
if (Environment.Version.Major >= 10)
{
if (options is null || options.EnableBlazorSupport)
{
builder.AddSource("Microsoft.AspNetCore.Components");
builder.AddSource("Microsoft.AspNetCore.Components.Server.Circuits");
}
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -102,6 +102,15 @@ internal AspNetCoreTraceInstrumentationOptions(IConfiguration configuration)
/// </remarks>
public bool EnableAspNetCoreSignalRSupport { get; set; } = true;

/// <summary>
/// Gets or sets a value indicating whether Blazor activities are recorded.
/// </summary>
/// <remarks>
/// Defaults to true.
/// Only applies to .NET 10.0 or greater.
/// </remarks>
public bool EnableBlazorSupport { get; set; } = true;

/// <summary>
/// Gets or sets a value indicating whether RPC attributes are added to an Activity when using Grpc.AspNetCore.
/// </summary>
Expand Down
51 changes: 51 additions & 0 deletions src/OpenTelemetry.Instrumentation.AspNetCore/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,57 @@

## Unreleased

* Added support for listening to ASP.NET Core Blazor activities.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is it Blazor only, or it should be adjusted?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Metrics were added for many features.
Activities were only added for Blazor.

Configurable with the
`AspNetCoreTraceInstrumentationOptions.EnableBlazorSupport`
option which defaults to `true`. Only applies to .NET 10.0 or greater.
([#3012](https://github.com/open-telemetry/opentelemetry-dotnet-contrib/pull/3012))

* Following metrics will now be enabled by default when targeting `.NET10.0` or
newer framework:

* **Meter** : `Microsoft.AspNetCore.MemoryPool`
* `aspnetcore.memory_pool.pooled`
* `aspnetcore.memory_pool.evicted`
* `aspnetcore.memory_pool.allocated`
* `aspnetcore.memory_pool.rented`
* **Meter** : `Microsoft.AspNetCore.Authentication`
* `aspnetcore.authentication.authenticate.duration`
* `aspnetcore.authentication.challenges`
* `aspnetcore.authentication.forbids`
* `aspnetcore.authentication.sign_ins`
* `aspnetcore.authentication.sign_outs`
* **Meter** : `Microsoft.AspNetCore.Authorization`
* `aspnetcore.authorization.attempts`
* **Meter** : `Microsoft.AspNetCore.Identity`
* `aspnetcore.identity.user.create.duration`
* `aspnetcore.identity.user.update.duration`
* `aspnetcore.identity.user.delete.duration`
* `aspnetcore.identity.user.check_password_attempts`
* `aspnetcore.identity.user.generated_tokens`
* `aspnetcore.identity.user.verify_token_attempts`
* `aspnetcore.identity.sign_in.authenticate.duration`
* `aspnetcore.identity.sign_in.check_password_attempts`
* `aspnetcore.identity.sign_in.sign_ins`
* `aspnetcore.identity.sign_in.sign_outs`
* `aspnetcore.identity.sign_in.two_factor_clients_remembered`
* `aspnetcore.identity.sign_in.two_factor_clients_forgotten`
* **Meter** : `Microsoft.AspNetCore.Components`
* `aspnetcore.components.navigate`
* `aspnetcore.components.handle_event.duration`
* **Meter** : `Microsoft.AspNetCore.Components.Lifecycle`
* `aspnetcore.components.update_parameters.duration`
* `aspnetcore.components.render_diff.duration`
* `aspnetcore.components.render_diff.size`
* **Meter** : `Microsoft.AspNetCore.Components.Server.Circuits`
* `aspnetcore.components.circuit.active`
* `aspnetcore.components.circuit.connected`
* `aspnetcore.components.circuit.duration`

For details about each individual metric check [ASP.NET Core
docs
page](https://learn.microsoft.com/dotnet/core/diagnostics/built-in-metrics-aspnetcore).

## 1.12.0

Released 2025-May-05
Expand Down
Loading