Last active
November 24, 2025 00:59
-
-
Save AnthonyGiretti/a1765f27445d9bbd2ca62d5ef86fd610 to your computer and use it in GitHub Desktop.
ASP.NET Core 10: New OpenTelemetry metrics for Identity
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| builder.Services | |
| .AddOpenTelemetry() | |
| .ConfigureResource(r => r.AddService( | |
| serviceName: builder.Environment.ApplicationName, | |
| serviceVersion: "1.0.0")) | |
| .WithMetrics(metrics => | |
| { | |
| // HTTP pipeline instrumentation (http.server.* etc.) | |
| metrics.AddAspNetCoreInstrumentation(); | |
| // Built-in ASP.NET Core meters: hosting + routing + diagnostics + rate limiting | |
| metrics.AddMeter( | |
| "Microsoft.AspNetCore.Hosting", | |
| "Microsoft.AspNetCore.Server.Kestrel", | |
| "Microsoft.AspNetCore.Routing", | |
| "Microsoft.AspNetCore.Diagnostics", | |
| "Microsoft.AspNetCore.RateLimiting", | |
| // NEW Identity metrics meter in ASP.NET Core 10 | |
| // Better end-to-end visibility: HTTP request → routing → middleware → Identity sign-in / sign-out. | |
| "Microsoft.AspNetCore.Identity"); | |
| // You can also add runtime / HttpClient metrics if you want: | |
| // metrics.AddRuntimeInstrumentation(); | |
| // metrics.AddHttpClientInstrumentation(); | |
| // Example exporter: Prometheus | |
| metrics.AddPrometheusExporter(); | |
| }); | |
| var app = builder.Build(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment