fix: only report enable authn/authz in telemetry

This commit is contained in:
Zhongwen Deng 2023-05-26 19:31:13 +08:00
parent b74dabe7eb
commit 8c814bc861
4 changed files with 4 additions and 3 deletions

View File

@ -106,7 +106,7 @@ get_enabled_authns() ->
AuthnTypes = lists:usort([ AuthnTypes = lists:usort([
Type Type
|| #{authenticators := As} <- Chains, || #{authenticators := As} <- Chains,
#{id := Type} <- As #{id := Type, enable := true} <- As
]), ]),
OverriddenListeners = OverriddenListeners =
lists:foldl( lists:foldl(

View File

@ -417,7 +417,7 @@ do_authorize(
end. end.
get_enabled_authzs() -> get_enabled_authzs() ->
lists:usort([Type || #{type := Type} <- lookup()]). lists:usort([Type || #{type := Type, enable := true} <- lookup()]).
%%-------------------------------------------------------------------- %%--------------------------------------------------------------------
%% Internal function %% Internal function

View File

@ -366,7 +366,7 @@ t_get_enabled_authzs_none_enabled(_Config) ->
?assertEqual([], emqx_authz:get_enabled_authzs()). ?assertEqual([], emqx_authz:get_enabled_authzs()).
t_get_enabled_authzs_some_enabled(_Config) -> t_get_enabled_authzs_some_enabled(_Config) ->
{ok, _} = emqx_authz:update(?CMD_REPLACE, [?SOURCE4]), {ok, _} = emqx_authz:update(?CMD_REPLACE, [?SOURCE4, ?SOURCE5#{<<"enable">> := false}]),
?assertEqual([postgresql], emqx_authz:get_enabled_authzs()). ?assertEqual([postgresql], emqx_authz:get_enabled_authzs()).
t_subscribe_deny_disconnect_publishes_last_will_testament(_Config) -> t_subscribe_deny_disconnect_publishes_last_will_testament(_Config) ->

View File

@ -0,0 +1 @@
Only include enabled authenticators and authorizers in telemetry report, not all of them.