|
1 | 1 | --- |
2 | 2 | title: ASP.NET Core metrics |
3 | | -description: Metrics for ASP.NET Core apps |
| 3 | +ai-usage: ai-assisted |
4 | 4 | author: tdykstra |
5 | | -ms.author: tdykstra |
| 5 | +description: Metrics for ASP.NET Core apps |
6 | 6 | monikerRange: '>= aspnetcore-8.0' |
7 | | -ms.date: 10/18/2023 |
| 7 | +ms.author: tdykstra |
| 8 | +ms.date: 11/10/2025 |
8 | 9 | ms.topic: article |
9 | 10 | uid: log-mon/metrics/metrics |
10 | 11 | --- |
@@ -262,6 +263,47 @@ The proceeding test: |
262 | 263 | * Makes an HTTP request to the web app. |
263 | 264 | * Asserts the test using results from the metrics collector. |
264 | 265 |
|
| 266 | +:::moniker range=">= aspnetcore-10.0" |
| 267 | + |
| 268 | +## ASP.NET Core Identity metrics |
| 269 | + |
| 270 | +ASP.NET Core Identity observability has been improved in .NET 10 with metrics. These metrics help you monitor user management activities and authentication processes. |
| 271 | + |
| 272 | +The metrics are in the `Microsoft.AspNetCore.Identity` meter and include: |
| 273 | + |
| 274 | +### User management metrics |
| 275 | + |
| 276 | +* `aspnetcore.identity.user.create.duration` - Measures the duration of user creation operations |
| 277 | +* `aspnetcore.identity.user.update.duration` - Measures the duration of user update operations |
| 278 | +* `aspnetcore.identity.user.delete.duration` - Measures the duration of user deletion operations |
| 279 | +* `aspnetcore.identity.user.check_password_attempts` - Counts password verification attempts |
| 280 | +* `aspnetcore.identity.user.generated_tokens` - Counts tokens generated for users (like password reset tokens) |
| 281 | +* `aspnetcore.identity.user.verify_token_attempts` - Counts token verification attempts |
| 282 | + |
| 283 | +### Authentication metrics |
| 284 | + |
| 285 | +* `aspnetcore.identity.sign_in.authenticate.duration` - Measures the duration of authentication operations |
| 286 | +* `aspnetcore.identity.sign_in.check_password_attempts` - Counts password check attempts during sign-in |
| 287 | +* `aspnetcore.identity.sign_in.sign_ins` - Counts successful sign-ins |
| 288 | +* `aspnetcore.identity.sign_in.sign_outs` - Counts sign-outs |
| 289 | +* `aspnetcore.identity.sign_in.two_factor_clients_remembered` - Counts remembered two-factor clients |
| 290 | +* `aspnetcore.identity.sign_in.two_factor_clients_forgotten` - Counts forgotten two-factor clients |
| 291 | + |
| 292 | +These metrics can be used to: |
| 293 | + |
| 294 | +* Monitor user registration and management |
| 295 | +* Track authentication patterns and potential security issues |
| 296 | +* Measure performance of Identity operations |
| 297 | +* Observe two-factor authentication usage |
| 298 | + |
| 299 | +You can view these metrics using the techniques described earlier in this article, such as `dotnet-counters` or Prometheus with Grafana. |
| 300 | + |
| 301 | +```dotnetcli |
| 302 | +dotnet-counters monitor -n YourAppName --counters Microsoft.AspNetCore.Identity |
| 303 | +``` |
| 304 | + |
| 305 | +:::moniker-end |
| 306 | + |
265 | 307 | ## ASP.NET Core meters and counters |
266 | 308 |
|
267 | 309 | See [ASP.NET Core metrics](/dotnet/core/diagnostics/built-in-metrics-aspnetcore) for a list of ASP.NET Core meters and counters. |
0 commit comments