Ver código fonte

Merge pull request #10833 from zhongwencool/telemtry-report

fix: only report enable authn/authz in telemetry
zhongwencool 2 anos atrás
pai
commit
2b6d3bb748

+ 1 - 1
apps/emqx_authn/src/emqx_authn.erl

@@ -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(

+ 1 - 1
apps/emqx_authz/src/emqx_authz.erl

@@ -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

+ 1 - 1
apps/emqx_authz/test/emqx_authz_SUITE.erl

@@ -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) ->

+ 1 - 0
changes/ce/fix-10833.en.md

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