Background and Motivation
API review of user manager metrics for #62078.
Proposed API
Microsoft.AspNetCore.Identity
aspnetcore.identity.user.create
| Name |
Instrument Type |
Unit |
Description |
aspnetcore.identity.user.create |
Counter |
count |
The number of users created. |
| Attribute |
Type |
Description |
Examples |
Presence |
aspnetcore.identity.user_type |
string |
The identity user type. |
ContosoUser |
Always |
aspnetcore.identity.result |
string |
The result of the identity operation. |
success; failure |
If no exception was thrown. |
aspnetcore.identity.result_error_code |
string |
The error code for a failed identity operation. |
DefaultError; PasswordMismatch |
If an error was set on a failed identity result. |
error.type |
string |
The full name of exception type. |
System.InvalidOperationException |
If an exception was thrown. |
aspnetcore.identity.user.update
| Name |
Instrument Type |
Unit |
Description |
aspnetcore.identity.user.update |
Counter |
count |
The number of user updates. |
| Attribute |
Type |
Description |
Examples |
Presence |
aspnetcore.identity.user_type |
string |
The identity user type. |
ContosoUser |
Always |
aspnetcore.identity.user.update_type |
string |
The user update type. |
update; user_name; reset_password |
Always |
aspnetcore.identity.result |
string |
The result of the identity operation. |
success; failure |
If no exception was thrown. |
aspnetcore.identity.result_error_code |
string |
The error code for a failed identity operation. |
DefaultError; PasswordMismatch |
If an error was set on a failed identity result. |
error.type |
string |
The full name of exception type. |
System.InvalidOperationException |
If an exception was thrown. |
aspnetcore.identity.user.delete
| Name |
Instrument Type |
Unit |
Description |
aspnetcore.identity.user.delete |
Counter |
count |
The number of users deleted. |
| Attribute |
Type |
Description |
Examples |
Presence |
aspnetcore.identity.user_type |
string |
The identity user type. |
ContosoUser |
Always |
aspnetcore.identity.result |
string |
The result of the identity operation. |
success; failure |
If no exception was thrown. |
aspnetcore.identity.result_error_code |
string |
The error code for a failed identity operation. |
DefaultError; PasswordMismatch |
If an error was set on a failed identity result. |
error.type |
string |
The full name of exception type. |
System.InvalidOperationException |
If an exception was thrown. |
aspnetcore.identity.user.check_password
| Name |
Instrument Type |
Unit |
Description |
aspnetcore.identity.user.check_password |
Counter |
count |
The number of check password attempts. Only checks whether the password is valid and not whether the user account is in a state that can log in. |
| Attribute |
Type |
Description |
Examples |
Presence |
aspnetcore.identity.user_type |
string |
The identity user type. |
ContosoUser |
Always |
aspnetcore.identity.user.password_result |
string |
The result from checking the password. |
success; failure |
If no exception was thrown. |
error.type |
string |
The full name of exception type. |
System.InvalidOperationException |
If an exception was thrown. |
aspnetcore.identity.user.verify_token
| Name |
Instrument Type |
Unit |
Description |
aspnetcore.identity.user.verify_token |
Counter |
count |
The number of token verification attempts. |
| Attribute |
Type |
Description |
Examples |
Presence |
aspnetcore.identity.user_type |
string |
The identity user type. |
ContosoUser |
Always |
aspnetcore.identity.token_purpose |
string |
What the token is used for. |
reset_password; two_factor |
Always |
aspnetcore.identity.token_verified |
string |
Result of verifying the token. |
success; failure |
If no exception was thrown. |
error.type |
string |
The full name of exception type. |
System.InvalidOperationException |
If an exception was thrown. |
aspnetcore.identity.user.generate_token
| Name |
Instrument Type |
Unit |
Description |
aspnetcore.identity.user.generate_token |
Counter |
count |
The number of tokens generated. |
| Attribute |
Type |
Description |
Examples |
Presence |
aspnetcore.identity.user_type |
string |
The identity user type. |
ContosoUser |
Always |
aspnetcore.identity.token_purpose |
string |
What the token is used for. |
reset_password; two_factor |
Always |
error.type |
string |
The full name of exception type. |
System.InvalidOperationException |
If an exception was thrown. |
Usage Examples
Alternative Designs
Risks
Activity
JamesNK commentedon May 28, 2025
@noahfalk @lmolkova @trask Hi. I'm adding metrics to ASP.NET Core identity. This issue is for folks to review metrics and their names. Feedback welcome on how well names match semantic conventions.
(there are quite a few metrics so I've split the review into two issues: #62131 and #62132)
noahfalk commentedon Jun 18, 2025
Hey James, very sorry for the delay! I saw I had this flagged weeks ago and then it slipped off my radar.
A couple questions I had reading over this:
JamesNK commentedon Jul 1, 2025
Removed verify_password counter.
sign_in.check_passwordusesuser.check_passwordinternally. The sign in manager checks also checks the state of the account allows it to log in.The sign in manager handles different auth credentials.
You would only use API for tokens related to user accounts. There is a token purpose on the counter that does its best to provide into about the purpose of the token.
noahfalk commentedon Jul 1, 2025
Do we expect non-token, non-password credentials to surface through these counters? The naming seemed fairly token and password specific.
halter73 commentedon Jul 3, 2025
API Review Notes:
JamesNK commentedon Jul 4, 2025
Which naming?
ASP.NET Core identity offers a tailored experience for doing user and sign in management in an app. If we support more in the future then we'll add new counters as needed.
JamesNK commentedon Jul 4, 2025
I think, for now, I'm not going to add read metrics. There are lots of kinds of reads and I'm not sure how to model them correctly.
e.g. get a user, get a property on a user, get if user is in a row, get multiple users by role, get multiple user by claim, etc.
Can add read metrics if people ask for them.
noahfalk commentedon Jul 7, 2025
Sounds just fine. Thanks James!