Skip to content

Commit a7b09b2

Browse files
Copilotwadepickettguardrex
authored
Add Identity metrics documentation for .NET 10 (#36324)
* Initial plan * Add Identity metrics documentation for .NET 10 Co-authored-by: wadepickett <10985336+wadepickett@users.noreply.github.com> * Update ASP.NET Core Identity documentation Fixed for moniker range. * Apply suggestion from @wadepickett Added to View Identity metric section * Apply suggestions from code review Suggested udpated from guardrex Co-authored-by: Luke Latham <1622880+guardrex@users.noreply.github.com> * Apply suggestion from @wadepickett Fixed comma * Fix punctuation and formatting in metrics.md Corrected punctuation and formatting for consistency in metrics documentation. --------- Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com> Co-authored-by: wadepickett <10985336+wadepickett@users.noreply.github.com> Co-authored-by: Wade Pickett <wpickett@microsoft.com> Co-authored-by: Luke Latham <1622880+guardrex@users.noreply.github.com>
1 parent a2efe38 commit a7b09b2

File tree

2 files changed

+66
-5
lines changed

2 files changed

+66
-5
lines changed

aspnetcore/log-mon/metrics/metrics.md

Lines changed: 50 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,11 @@
11
---
22
title: ASP.NET Core metrics
3-
description: Metrics for ASP.NET Core apps
3+
ai-usage: ai-assisted
44
author: tdykstra
5-
ms.author: tdykstra
5+
description: Metrics for ASP.NET Core apps
66
monikerRange: '>= aspnetcore-8.0'
7-
ms.date: 10/18/2023
7+
ms.author: tdykstra
8+
ms.date: 11/10/2025
89
ms.topic: article
910
uid: log-mon/metrics/metrics
1011
---
@@ -256,12 +257,57 @@ The proceeding test:
256257

257258
* Bootstraps a web app in memory with <xref:Microsoft.AspNetCore.Mvc.Testing.WebApplicationFactory%601>. `Program` in the factory's generic argument specifies the web app.
258259
* Collects metrics values with <xref:Microsoft.Extensions.Diagnostics.Metrics.Testing.MetricCollector%601>
259-
* Requires a package reference to `Microsoft.Extensions.Diagnostics.Testing`
260+
* Requires a package reference to `Microsoft.Extensions.Diagnostics.Testing`.
260261
* The `MetricCollector<T>` is created using the web app's <xref:System.Diagnostics.Metrics.IMeterFactory>. This allows the collector to only report metrics values recorded by test.
261262
* Includes the meter name, `Microsoft.AspNetCore.Hosting`, and counter name, `http.server.request.duration` to collect.
262263
* Makes an HTTP request to the web app.
263264
* Asserts the test using results from the metrics collector.
264265

266+
:::moniker range=">= aspnetcore-10.0"
267+
268+
## ASP.NET Core Identity metrics
269+
270+
ASP.NET Core Identity observability help you monitor user management activities and authentication processes.
271+
272+
The metrics are in the `Microsoft.AspNetCore.Identity` meter and are described in the following sections.
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, such as 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+
### Viewing Identity metrics
300+
301+
You can view these metrics using `dotnet-counters` to monitor them in real-time or export them to Prometheus and visualize them in Grafana using the techniques described earlier in this article.
302+
303+
For example, to monitor all Identity metrics with `dotnet-counters`:
304+
305+
```dotnetcli
306+
dotnet-counters monitor -n YourAppName --counters Microsoft.AspNetCore.Identity
307+
```
308+
309+
:::moniker-end
310+
265311
## ASP.NET Core meters and counters
266312

267313
See [ASP.NET Core metrics](/dotnet/core/diagnostics/built-in-metrics-aspnetcore) for a list of ASP.NET Core meters and counters.

aspnetcore/security/authentication/identity.md

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,11 @@
11
---
22
title: Introduction to Identity on ASP.NET Core
3+
ai-usage: ai-assisted
34
author: wadepickett
45
description: Use Identity with an ASP.NET Core app. Learn how to set password requirements (RequireDigit, RequiredLength, RequiredUniqueChars, and more).
56
monikerRange: '>= aspnetcore-3.0'
67
ms.author: wpickett
7-
ms.date: 10/30/2025
8+
ms.date: 11/10/2025
89
uid: security/authentication/identity
910
---
1011
# Introduction to Identity on ASP.NET Core
@@ -202,6 +203,20 @@ The template-generated app doesn't use [authorization](xref:security/authorizati
202203

203204
For more information on `IdentityOptions`, see <xref:Microsoft.AspNetCore.Identity.IdentityOptions> and [Application Startup](xref:fundamentals/startup).
204205

206+
:::moniker-end
207+
208+
:::moniker range=">= aspnetcore-10.0"
209+
210+
## ASP.NET Core Identity metrics
211+
212+
ASP.NET Core Identity metrics provide monitoring capabilities for user management and authentication processes. These metrics help you detect unusual sign-in patterns that might indicate security threats, track the performance of identity operations, and understand how users interact with authentication features, such as two-factor authentication. This observability is particularly valuable for apps with strict security requirements or those experiencing high authentication traffic.
213+
214+
For complete details on available metrics and how to use them, see <xref:log-mon/metrics/metrics#aspnet-core-identity-metrics>.
215+
216+
:::moniker-end
217+
218+
:::moniker range=">= aspnetcore-8.0"
219+
205220
<!-- Start here for .NET 6 -->
206221

207222
## Scaffold Register, Login, LogOut, and RegisterConfirmation

0 commit comments

Comments
 (0)