fix: telemetry can't get active plugins list

This commit is contained in:
Zhongwen Deng 2022-05-12 11:17:47 +08:00
parent 16b6c2f849
commit f0cb72dda6
4 changed files with 6 additions and 25 deletions

View File

@ -102,19 +102,6 @@
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
%%--------------------------------------------------------------------

View File

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

View File

@ -759,11 +759,6 @@ print({emqx_topic, #route{topic = Topic, dest = {_, Node}}}) ->
emqx_ctl:print("~ts -> ~ts~n", [Topic, Node]);
print({emqx_topic, #route{topic = Topic, dest = 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) ->
emqx_ctl:print("~ts -> ~ts~n", [maps:get(subid, Options), Topic]).

View File

@ -278,11 +278,12 @@ nodes_uuid() ->
active_plugins() ->
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,
[],
emqx_plugins:list()