@@ -18,31 +18,31 @@ internal sealed class AuthorizationMetrics
1818 public const string MeterName = "Microsoft.AspNetCore.Authorization" ;
1919
2020 private readonly Meter _meter ;
21- private readonly Counter < long > _authorizedRequestCount ;
21+ private readonly Counter < long > _authorizedCount ;
2222
2323 public AuthorizationMetrics ( IMeterFactory meterFactory )
2424 {
2525 _meter = meterFactory . Create ( MeterName ) ;
2626
27- _authorizedRequestCount = _meter . CreateCounter < long > (
27+ _authorizedCount = _meter . CreateCounter < long > (
2828 "aspnetcore.authorization.attempts" ,
29- unit : "{request }" ,
30- description : "The total number of requests for which authorization was attempted ." ) ;
29+ unit : "{attempt }" ,
30+ description : "The total number of authorization attempts ." ) ;
3131 }
3232
33- public void AuthorizedRequestCompleted ( ClaimsPrincipal user , string ? policyName , AuthorizationResult ? result , Exception ? exception )
33+ public void AuthorizeAttemptCompleted ( ClaimsPrincipal user , string ? policyName , AuthorizationResult ? result , Exception ? exception )
3434 {
35- if ( _authorizedRequestCount . Enabled )
35+ if ( _authorizedCount . Enabled )
3636 {
37- AuthorizedRequestCompletedCore ( user , policyName , result , exception ) ;
37+ AuthorizeAttemptCore ( user , policyName , result , exception ) ;
3838 }
3939 }
4040
4141 [ MethodImpl ( MethodImplOptions . NoInlining ) ]
42- private void AuthorizedRequestCompletedCore ( ClaimsPrincipal user , string ? policyName , AuthorizationResult ? result , Exception ? exception )
42+ private void AuthorizeAttemptCore ( ClaimsPrincipal user , string ? policyName , AuthorizationResult ? result , Exception ? exception )
4343 {
4444 var tags = new TagList ( [
45- new ( "user.is_authenticated" , user . Identity ? . IsAuthenticated ?? false )
45+ new ( "aspnetcore. user.is_authenticated" , user . Identity ? . IsAuthenticated ?? false )
4646 ] ) ;
4747
4848 if ( policyName is not null )
@@ -61,6 +61,6 @@ private void AuthorizedRequestCompletedCore(ClaimsPrincipal user, string? policy
6161 tags . Add ( "error.type" , exception . GetType ( ) . FullName ) ;
6262 }
6363
64- _authorizedRequestCount . Add ( 1 , tags ) ;
64+ _authorizedCount . Add ( 1 , tags ) ;
6565 }
6666}
0 commit comments