Skip to content
This repository was archived by the owner on Mar 9, 2026. It is now read-only.
Merged
Show file tree
Hide file tree
Changes from all 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
3 changes: 2 additions & 1 deletion docs/fundamentals/service-defaults.md
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,8 @@ The `ConfigureOpenTelemetry` method:
- Adds [.NET Aspire telemetry](telemetry.md) logging to include formatted messages and scopes.
- Adds OpenTelemetry metrics and tracing that include:
- Runtime instrumentation metrics.
- Builtin meters.
- ASP.NET Core instrumentation metrics.
- HttpClient instrumentation metrics.
- In a development environment, the `AlwaysOnSampler` is used to view all traces.
- Tracing details for ASP.NET Core, gRPC and HTTP instrumentation.
- Adds OpenTelemetry exporters, by calling `AddOpenTelemetryExporters`.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,8 +41,9 @@ public static IHostApplicationBuilder ConfigureOpenTelemetry(this IHostApplicati
builder.Services.AddOpenTelemetry()
.WithMetrics(metrics =>
{
metrics.AddRuntimeInstrumentation()
.AddBuiltInMeters();
metrics.AddAspNetCoreInstrumentation()
.AddHttpClientInstrumentation()
.AddRuntimeInstrumentation();
})
.WithTracing(tracing =>
{
Expand Down Expand Up @@ -109,10 +110,4 @@ public static WebApplication MapDefaultEndpoints(this WebApplication app)

return app;
}

private static MeterProviderBuilder AddBuiltInMeters(this MeterProviderBuilder meterProviderBuilder) =>
meterProviderBuilder.AddMeter(
"Microsoft.AspNetCore.Hosting",
"Microsoft.AspNetCore.Server.Kestrel",
"System.Net.Http");
}
14 changes: 3 additions & 11 deletions docs/fundamentals/snippets/template/YourAppName/Extensions.cs
Original file line number Diff line number Diff line change
Expand Up @@ -47,8 +47,9 @@ public static IHostApplicationBuilder ConfigureOpenTelemetry(
builder.Services.AddOpenTelemetry()
.WithMetrics(metrics =>
{
metrics.AddRuntimeInstrumentation()
.AddBuiltInMeters();
metrics.AddAspNetCoreInstrumentation()
.AddHttpClientInstrumentation()
.AddRuntimeInstrumentation();
})
.WithTracing(tracing =>
{
Expand Down Expand Up @@ -133,13 +134,4 @@ public static WebApplication MapDefaultEndpoints(this WebApplication app)
return app;
}
// </mapdefaultendpoints>

// <addmeters>
private static MeterProviderBuilder AddBuiltInMeters(
this MeterProviderBuilder meterProviderBuilder) =>
meterProviderBuilder.AddMeter(
"Microsoft.AspNetCore.Hosting",
"Microsoft.AspNetCore.Server.Kestrel",
"System.Net.Http");
// </addmeters>
}