Merge pull request #7927 from zhongwencool/delete-unuse-plugin-record

fix: telemetry can't get active plugins list
This commit is contained in:
zhongwencool 2022-05-12 14:46:25 +08:00 committed by GitHub
commit a76628dd6c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 6 additions and 25 deletions

View File

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

View File

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

View File

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

View File

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