Просмотр исходного кода

fix: telemetry can't get active plugins list

Zhongwen Deng 3 лет назад
Родитель
Сommit
f0cb72dda6

+ 0 - 13
apps/emqx/include/emqx.hrl

@@ -102,19 +102,6 @@
     dest :: node() | {binary(), node()} | emqx_session:sessionID()
     dest :: node() | {binary(), node()} | emqx_session:sessionID()
 }).
 }).
 
 
-%%--------------------------------------------------------------------
-%% Plugin
-%%--------------------------------------------------------------------
-
--record(plugin, {
-    name :: atom(),
-    dir :: string() | undefined,
-    descr :: string(),
-    vendor :: string() | undefined,
-    active = false :: boolean(),
-    info = #{} :: map()
-}).
-
 %%--------------------------------------------------------------------
 %%--------------------------------------------------------------------
 %% Command
 %% Command
 %%--------------------------------------------------------------------
 %%--------------------------------------------------------------------

+ 0 - 2
apps/emqx/src/emqx_types.erl

@@ -88,7 +88,6 @@
 ]).
 ]).
 
 
 -export_type([
 -export_type([
-    plugin/0,
     banned/0,
     banned/0,
     command/0
     command/0
 ]).
 ]).
@@ -231,7 +230,6 @@
 -type route() :: #route{}.
 -type route() :: #route{}.
 -type group() :: emqx_topic:group().
 -type group() :: emqx_topic:group().
 -type route_entry() :: {topic(), node()} | {topic, group()}.
 -type route_entry() :: {topic(), node()} | {topic, group()}.
--type plugin() :: #plugin{}.
 -type command() :: #command{}.
 -type command() :: #command{}.
 
 
 -type caps() :: emqx_mqtt_caps:caps().
 -type caps() :: emqx_mqtt_caps:caps().

+ 0 - 5
apps/emqx_management/src/emqx_mgmt_cli.erl

@@ -759,11 +759,6 @@ print({emqx_topic, #route{topic = Topic, dest = {_, Node}}}) ->
     emqx_ctl:print("~ts -> ~ts~n", [Topic, Node]);
     emqx_ctl:print("~ts -> ~ts~n", [Topic, Node]);
 print({emqx_topic, #route{topic = Topic, dest = Node}}) ->
 print({emqx_topic, #route{topic = Topic, dest = Node}}) ->
     emqx_ctl:print("~ts -> ~ts~n", [Topic, Node]);
     emqx_ctl:print("~ts -> ~ts~n", [Topic, Node]);
-print(#plugin{name = Name, descr = Descr, active = Active}) ->
-    emqx_ctl:print(
-        "Plugin(~ts, description=~ts, active=~ts)~n",
-        [Name, Descr, Active]
-    );
 print({emqx_suboption, {{Pid, Topic}, Options}}) when is_pid(Pid) ->
 print({emqx_suboption, {{Pid, Topic}, Options}}) when is_pid(Pid) ->
     emqx_ctl:print("~ts -> ~ts~n", [maps:get(subid, Options), Topic]).
     emqx_ctl:print("~ts -> ~ts~n", [maps:get(subid, Options), Topic]).
 
 

+ 6 - 5
apps/emqx_modules/src/emqx_telemetry.erl

@@ -278,11 +278,12 @@ nodes_uuid() ->
 
 
 active_plugins() ->
 active_plugins() ->
     lists:foldl(
     lists:foldl(
-        fun(#plugin{name = Name, active = Active}, Acc) ->
-            case Active of
-                true -> [Name | Acc];
-                false -> Acc
-            end
+        fun
+            (#{running_status := running} = Plugin, Acc) ->
+                #{<<"name">> := Name, <<"rel_vsn">> := Vsn} = Plugin,
+                [iolist_to_binary([Name, "-", Vsn]) | Acc];
+            (_, Acc) ->
+                Acc
         end,
         end,
         [],
         [],
         emqx_plugins:list()
         emqx_plugins:list()