Merge pull request #10833 from zhongwencool/telemtry-report

fix: only report enable authn/authz in telemetry
This commit is contained in:
zhongwencool 2023-05-29 15:14:36 +08:00 committed by GitHub
commit 2b6d3bb748
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 4 additions and 3 deletions

View File

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

View File

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

View File

@ -366,7 +366,7 @@ t_get_enabled_authzs_none_enabled(_Config) ->
?assertEqual([], emqx_authz:get_enabled_authzs()).
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()).
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.