From 9170a059908683fbeb1749e80432cf79ea5fbb4c Mon Sep 17 00:00:00 2001 From: firest Date: Fri, 1 Jul 2022 15:14:46 +0800 Subject: [PATCH] fix(metrics): fix authn metrics count clause error --- apps/emqx/src/emqx_authentication.erl | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-) diff --git a/apps/emqx/src/emqx_authentication.erl b/apps/emqx/src/emqx_authentication.erl index f153f1367..e7e89465d 100644 --- a/apps/emqx/src/emqx_authentication.erl +++ b/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 ->