Skip to content

Commit 1eb1d5b

Browse files
committed
Update
1 parent 4e7af64 commit 1eb1d5b

File tree

3 files changed

+9
-9
lines changed

3 files changed

+9
-9
lines changed

src/Identity/Core/src/SignInManagerMetrics.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ public SignInManagerMetrics(IMeterFactory meterFactory)
3030
{
3131
_meter = meterFactory.Create(MeterName);
3232

33-
_authenticateDuration = _meter.CreateHistogram<double>(AuthenticateDurationName, "s", "The number of authenticate attempts. The authenticate counter is incremented by sign in methods such as PasswordSignInAsync and TwoFactorSignInAsync.");
33+
_authenticateDuration = _meter.CreateHistogram<double>(AuthenticateDurationName, "s", "The duration of authenticate attempts. The authenticate metrics is recorded by sign in methods such as PasswordSignInAsync and TwoFactorSignInAsync.");
3434
_rememberTwoFactorClientCounter = _meter.CreateCounter<long>(RememberedTwoFactorCounterName, "{client}", "The number of two factor clients remembered.");
3535
_forgetTwoFactorCounter = _meter.CreateCounter<long>(ForgottenTwoFactorCounterName, "{client}", "The number of two factor clients forgotten.");
3636
_checkPasswordCounter = _meter.CreateCounter<long>(CheckPasswordAttemptsCounterName, "{attempts}", "The number of check password attempts. Checks that the account is in a state that can log in and that the password is valid using the UserManager.CheckPasswordAsync method.");

src/Identity/Extensions.Core/src/UserManagerMetrics.cs

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ internal sealed class UserManagerMetrics : IDisposable
1818
public const string CreateDurationName = "aspnetcore.identity.user.create.duration";
1919
public const string UpdateDurationName = "aspnetcore.identity.user.update.duration";
2020
public const string DeleteDurationName = "aspnetcore.identity.user.delete.duration";
21-
public const string CheckPasswordCounterName = "aspnetcore.identity.user.check_password_attempts";
21+
public const string CheckPasswordAttemptsCounterName = "aspnetcore.identity.user.check_password_attempts";
2222
public const string VerifyTokenAttemptsCounterName = "aspnetcore.identity.user.verify_token_attempts";
2323
public const string GenerateTokensCounterName = "aspnetcore.identity.user.generated_tokens";
2424

@@ -33,10 +33,10 @@ internal sealed class UserManagerMetrics : IDisposable
3333
public UserManagerMetrics(IMeterFactory meterFactory)
3434
{
3535
_meter = meterFactory.Create(MeterName);
36-
_createDuration = _meter.CreateHistogram<double>(CreateDurationName, "s", "The number of users created.");
37-
_updateDuration = _meter.CreateHistogram<double>(UpdateDurationName, "s", "The number of users updated.");
38-
_deleteDuration = _meter.CreateHistogram<double>(DeleteDurationName, "s", "The number of users deleted.");
39-
_checkPasswordAttemptsCounter = _meter.CreateCounter<long>(CheckPasswordCounterName, "{attempt}", "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.");
36+
_createDuration = _meter.CreateHistogram<double>(CreateDurationName, "s", "The duration of creating users.");
37+
_updateDuration = _meter.CreateHistogram<double>(UpdateDurationName, "s", "The duration of updating users.");
38+
_deleteDuration = _meter.CreateHistogram<double>(DeleteDurationName, "s", "The duration of deleting users.");
39+
_checkPasswordAttemptsCounter = _meter.CreateCounter<long>(CheckPasswordAttemptsCounterName, "{attempt}", "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.");
4040
_verifyTokenAttemptsCounter = _meter.CreateCounter<long>(VerifyTokenAttemptsCounterName, "{attempt}", "The number of token verification attempts.");
4141
_generateTokensCounter = _meter.CreateCounter<long>(GenerateTokensCounterName, "{count}", "The number of token generations.");
4242
}

src/Identity/test/Identity.Test/UserManagerTest.cs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -628,7 +628,7 @@ public async Task CheckPasswordWillRehashPasswordWhenNeeded()
628628
// Setup
629629
var testMeterFactory = new TestMeterFactory();
630630
using var updateUser = new MetricCollector<double>(testMeterFactory, "Microsoft.AspNetCore.Identity", UserManagerMetrics.UpdateDurationName);
631-
using var checkPassword = new MetricCollector<long>(testMeterFactory, "Microsoft.AspNetCore.Identity", UserManagerMetrics.CheckPasswordCounterName);
631+
using var checkPassword = new MetricCollector<long>(testMeterFactory, "Microsoft.AspNetCore.Identity", UserManagerMetrics.CheckPasswordAttemptsCounterName);
632632

633633
var store = new Mock<IUserPasswordStore<PocoUser>>();
634634
var hasher = new Mock<IPasswordHasher<PocoUser>>();
@@ -864,7 +864,7 @@ public async Task RemovePasskeyAsyncCallsStore()
864864
public async Task CheckPasswordWithNullUserReturnsFalse()
865865
{
866866
var testMeterFactory = new TestMeterFactory();
867-
using var checkPassword = new MetricCollector<long>(testMeterFactory, "Microsoft.AspNetCore.Identity", UserManagerMetrics.CheckPasswordCounterName);
867+
using var checkPassword = new MetricCollector<long>(testMeterFactory, "Microsoft.AspNetCore.Identity", UserManagerMetrics.CheckPasswordAttemptsCounterName);
868868

869869
var manager = MockHelpers.TestUserManager(new EmptyStore(), meterFactory: testMeterFactory);
870870
Assert.False(await manager.CheckPasswordAsync(null, "whatevs"));
@@ -970,7 +970,7 @@ public async Task PasswordMethodsFailWhenStoreNotImplemented()
970970
var testMeterFactory = new TestMeterFactory();
971971
using var createUser = new MetricCollector<double>(testMeterFactory, "Microsoft.AspNetCore.Identity", UserManagerMetrics.CreateDurationName);
972972
using var updateUser = new MetricCollector<double>(testMeterFactory, "Microsoft.AspNetCore.Identity", UserManagerMetrics.UpdateDurationName);
973-
using var checkPassword = new MetricCollector<long>(testMeterFactory, "Microsoft.AspNetCore.Identity", UserManagerMetrics.CheckPasswordCounterName);
973+
using var checkPassword = new MetricCollector<long>(testMeterFactory, "Microsoft.AspNetCore.Identity", UserManagerMetrics.CheckPasswordAttemptsCounterName);
974974

975975
var manager = MockHelpers.TestUserManager(new NoopUserStore(), meterFactory: testMeterFactory);
976976
Assert.False(manager.SupportsUserPassword);

0 commit comments

Comments
 (0)