Browse Source

Merge pull request #8375 from lafirest/fix/authn_metrics_clause

fix(metrics): fix authn metrics count clause error
JianBo He 3 năm trước cách đây
mục cha
commit
127ecdbf77
1 tập tin đã thay đổi với 9 bổ sung8 xóa
  1. 9 8
      apps/emqx/src/emqx_authentication.erl

+ 9 - 8
apps/emqx/src/emqx_authentication.erl

@@ -226,14 +226,15 @@ authenticate(#{listener := Listener, protocol := Protocol} = Credential, _AuthRe
                     ignore;
                 NAuthenticators ->
                     Result = do_authenticate(ChainName, NAuthenticators, Credential),
-                    inc_authenticate_metric(
-                        case Result of
-                            {stop, {ok, _}} ->
-                                'authentication.success';
-                            _ ->
-                                'authentication.failure'
-                        end
-                    ),
+
+                    case Result of
+                        {stop, {ok, _}} ->
+                            inc_authenticate_metric('authentication.success');
+                        {stop, {error, _}} ->
+                            inc_authenticate_metric('authentication.failure');
+                        _ ->
+                            ok
+                    end,
                     Result
             end;
         none ->