Skip to content

Commit 1725d26

Browse files
committed
PR feedback
1 parent fc6ad96 commit 1725d26

File tree

2 files changed

+17
-17
lines changed

2 files changed

+17
-17
lines changed

src/Identity/Core/src/SignInManagerMetrics.cs

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ internal void CheckPasswordSignIn(string userType, SignInResult? result, Excepti
4949
{ "aspnetcore.identity.user_type", userType },
5050
};
5151
AddSignInResult(ref tags, result);
52-
AddExceptionTags(ref tags, exception);
52+
AddErrorTag(ref tags, exception);
5353

5454
_checkPasswordCounter.Add(1, tags);
5555
}
@@ -69,7 +69,7 @@ internal void AuthenticateSignIn(string userType, string authenticationScheme, S
6969
};
7070
AddIsPersistent(ref tags, isPersistent);
7171
AddSignInResult(ref tags, result);
72-
AddExceptionTags(ref tags, exception);
72+
AddErrorTag(ref tags, exception);
7373

7474
_authenticateCounter.Add(1, tags);
7575
}
@@ -87,7 +87,7 @@ internal void SignInUserPrincipal(string userType, string authenticationScheme,
8787
{ "aspnetcore.identity.authentication_scheme", authenticationScheme },
8888
};
8989
AddIsPersistent(ref tags, isPersistent);
90-
AddExceptionTags(ref tags, exception);
90+
AddErrorTag(ref tags, exception);
9191

9292
_signInUserPrincipalCounter.Add(1, tags);
9393
}
@@ -104,7 +104,7 @@ internal void SignOutUserPrincipal(string userType, string authenticationScheme,
104104
{ "aspnetcore.identity.user_type", userType },
105105
{ "aspnetcore.identity.authentication_scheme", authenticationScheme },
106106
};
107-
AddExceptionTags(ref tags, exception);
107+
AddErrorTag(ref tags, exception);
108108

109109
_signOutUserPrincipalCounter.Add(1, tags);
110110
}
@@ -121,7 +121,7 @@ internal void RememberTwoFactorClient(string userType, string authenticationSche
121121
{ "aspnetcore.identity.user_type", userType },
122122
{ "aspnetcore.identity.authentication_scheme", authenticationScheme }
123123
};
124-
AddExceptionTags(ref tags, exception);
124+
AddErrorTag(ref tags, exception);
125125

126126
_rememberTwoFactorClientCounter.Add(1, tags);
127127
}
@@ -138,7 +138,7 @@ internal void ForgetTwoFactorClient(string userType, string authenticationScheme
138138
{ "aspnetcore.identity.user_type", userType },
139139
{ "aspnetcore.identity.authentication_scheme", authenticationScheme }
140140
};
141-
AddExceptionTags(ref tags, exception);
141+
AddErrorTag(ref tags, exception);
142142

143143
_forgetTwoFactorCounter.Add(1, tags);
144144
}
@@ -164,7 +164,7 @@ private static void AddSignInResult(ref TagList tags, SignInResult? result)
164164
}
165165
}
166166

167-
private static void AddExceptionTags(ref TagList tags, Exception? exception)
167+
private static void AddErrorTag(ref TagList tags, Exception? exception)
168168
{
169169
if (exception != null)
170170
{

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

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -32,9 +32,9 @@ internal sealed class UserManagerMetrics : IDisposable
3232
public UserManagerMetrics(IMeterFactory meterFactory)
3333
{
3434
_meter = meterFactory.Create(MeterName);
35-
_createCounter = _meter.CreateCounter<long>(CreateCounterName, "{create}", "The number of users created.");
36-
_updateCounter = _meter.CreateCounter<long>(UpdateCounterName, "{update}", "The number of user updates.");
37-
_deleteCounter = _meter.CreateCounter<long>(DeleteCounterName, "{delete}", "The number of users deleted.");
35+
_createCounter = _meter.CreateCounter<long>(CreateCounterName, "{user}", "The number of users created.");
36+
_updateCounter = _meter.CreateCounter<long>(UpdateCounterName, "{user}", "The number of users updated.");
37+
_deleteCounter = _meter.CreateCounter<long>(DeleteCounterName, "{user}", "The number of users deleted.");
3838
_checkPasswordCounter = _meter.CreateCounter<long>(CheckPasswordCounterName, "{check}", "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.");
3939
_verifyTokenCounter = _meter.CreateCounter<long>(VerifyTokenCounterName, "{count}", "The number of token verification attempts.");
4040
_generateTokenCounter = _meter.CreateCounter<long>(GenerateTokenCounterName, "{count}", "The number of token generation attempts.");
@@ -52,7 +52,7 @@ internal void CreateUser(string userType, IdentityResult? result, Exception? exc
5252
{ "aspnetcore.identity.user_type", userType }
5353
};
5454
AddIdentityResultTags(ref tags, result);
55-
AddExceptionTags(ref tags, exception, result: result);
55+
AddErrorTag(ref tags, exception, result: result);
5656

5757
_createCounter.Add(1, tags);
5858
}
@@ -70,7 +70,7 @@ internal void UpdateUser(string userType, IdentityResult? result, UserUpdateType
7070
{ "aspnetcore.identity.user.update_type", GetUpdateType(updateType) },
7171
};
7272
AddIdentityResultTags(ref tags, result);
73-
AddExceptionTags(ref tags, exception, result: result);
73+
AddErrorTag(ref tags, exception, result: result);
7474

7575
_updateCounter.Add(1, tags);
7676
}
@@ -87,7 +87,7 @@ internal void DeleteUser(string userType, IdentityResult? result, Exception? exc
8787
{ "aspnetcore.identity.user_type", userType }
8888
};
8989
AddIdentityResultTags(ref tags, result);
90-
AddExceptionTags(ref tags, exception, result: result);
90+
AddErrorTag(ref tags, exception, result: result);
9191

9292
_deleteCounter.Add(1, tags);
9393
}
@@ -107,7 +107,7 @@ internal void CheckPassword(string userType, bool? userMissing, PasswordVerifica
107107
{
108108
tags.Add("aspnetcore.identity.password_check_result", GetPasswordResult(result, passwordMissing: null, userMissing));
109109
}
110-
AddExceptionTags(ref tags, exception);
110+
AddErrorTag(ref tags, exception);
111111

112112
_checkPasswordCounter.Add(1, tags);
113113
}
@@ -128,7 +128,7 @@ internal void VerifyToken(string userType, bool? result, string purpose, Excepti
128128
{
129129
tags.Add("aspnetcore.identity.token_verified", result == true ? "success" : "failure");
130130
}
131-
AddExceptionTags(ref tags, exception);
131+
AddErrorTag(ref tags, exception);
132132

133133
_verifyTokenCounter.Add(1, tags);
134134
}
@@ -145,7 +145,7 @@ internal void GenerateToken(string userType, string purpose, Exception? exceptio
145145
{ "aspnetcore.identity.user_type", userType },
146146
{ "aspnetcore.identity.token_purpose", GetTokenPurpose(purpose) },
147147
};
148-
AddExceptionTags(ref tags, exception);
148+
AddErrorTag(ref tags, exception);
149149

150150
_generateTokenCounter.Add(1, tags);
151151
}
@@ -187,7 +187,7 @@ private static void AddIdentityResultTags(ref TagList tags, IdentityResult? resu
187187
}
188188
}
189189

190-
private static void AddExceptionTags(ref TagList tags, Exception? exception, IdentityResult? result = null)
190+
private static void AddErrorTag(ref TagList tags, Exception? exception, IdentityResult? result = null)
191191
{
192192
var value = exception?.GetType().FullName ?? result?.Errors.FirstOrDefault()?.Code;
193193
if (value != null)

0 commit comments

Comments
 (0)