-
Notifications
You must be signed in to change notification settings - Fork 10.4k
Add metrics to Identity #62078
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Add metrics to Identity #62078
Conversation
c68f365
to
53c0e78
Compare
Ready to review. Please take a look. |
@MackinnonBuck I've added metrics to some of the passkey methods you recently added. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
This PR instruments UserManager
and SignInManager
with OpenTelemetry-compatible metrics, extends test helpers to support metrics collection, and updates existing tests and project references to validate the new metrics.
- Introduces
UserManagerMetrics
andSignInManagerMetrics
and registers them via DI - Augments
MockHelpers
andTestUserManager
/TestSignInManager
to accept anIMeterFactory
and emit metrics - Updates tests across
Identity.Test
to assert that the correct tags are recorded for each metric
Reviewed Changes
Copilot reviewed 14 out of 14 changed files in this pull request and generated no comments.
Show a summary per file
File | Description |
---|---|
src/Identity/Extensions.Core/src/UserManagerMetrics.cs | New metrics class for user manager operations |
src/Identity/Extensions.Core/src/UserManager.cs | Instruments all public methods to record metrics and exposes ServiceProvider |
src/Identity/Core/src/SignInManagerMetrics.cs | New metrics class for sign-in manager operations |
src/Identity/Core/src/SignInManager.cs | Instruments sign-in methods to record metrics |
src/Identity/test/Shared/MockHelpers.cs | MockUserManager /TestUserManager updated to accept IMeterFactory |
src/Identity/test/Shared/MetricsHelpers.cs | New helper for asserting metric tag collections |
src/Identity/test/Identity.Test/UserManagerTest.cs | Tests updated to collect and assert on emitted metrics |
src/Http/Authentication.Core/src/AuthenticationService.cs | Minor doc-comment fix in authentication service |
src/Http/Authentication.Abstractions/src/IAuthenticationService.cs | Minor doc-comment fix in auth service interface |
Comments suppressed due to low confidence (3)
src/Identity/Extensions.Core/src/UserManager.cs:1255
- Method name 'ResolveFromtRolesCoreAsync' contains a typo and is inconsistent with the public API. Rename it to 'RemoveFromRolesCoreAsync' to match 'RemoveFromRolesAsync'.
throw;
src/Http/Authentication.Core/src/AuthenticationService.cs:148
- [nitpick] The doc comment has a redundant 'in'; consider revising to 'Sign in a principal for the specified authentication scheme.'
/// Sign in a principal in for the specified authentication scheme.
src/Http/Authentication.Abstractions/src/IAuthenticationService.cs:43
- [nitpick] The doc comment has a redundant 'in'; consider revising to 'Sign in a principal for the specified authentication scheme.'
/// Sign in a principal in for the specified authentication scheme.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Are we considering RoleManager
out of scope for these metrics?
a637d35
to
c3cb40e
Compare
API review feedback applied. Please do a final review and lets get this merged 🙏 |
/azp run |
Azure Pipelines successfully started running 3 pipeline(s). |
Fixes #52996