Explorar o código

fix(metrics): fix authn metrics count clause error

firest %!s(int64=3) %!d(string=hai) anos
pai
achega
9170a05990
Modificáronse 1 ficheiros con 9 adicións e 8 borrados
  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 ->