feat(rules): remove stats update from rule_engine_registry (#5029)
This commit is contained in:
parent
c0367fb8dd
commit
5962c9c83c
|
@ -4,13 +4,16 @@
|
|||
[ {load_module, emqx_rule_funcs, brutal_purge, soft_purge, []}
|
||||
, {load_module, emqx_rule_engine, brutal_purge, soft_purge, []}
|
||||
, {load_module, emqx_rule_registry, brutal_purge, soft_purge, []}
|
||||
, {apply, {supervisor, restart_child, [emqx_rule_engine_sup, emqx_rule_registry]}}
|
||||
]},
|
||||
{"4.3.1",
|
||||
[ {load_module, emqx_rule_engine, brutal_purge, soft_purge, []}
|
||||
, {load_module, emqx_rule_registry, brutal_purge, soft_purge, []}
|
||||
, {apply, {supervisor, restart_child, [emqx_rule_engine_sup, emqx_rule_registry]}}
|
||||
]},
|
||||
{"4.3.2",
|
||||
[ {load_module, emqx_rule_registry, brutal_purge, soft_purge, []}
|
||||
, {apply, {supervisor, restart_child, [emqx_rule_engine_sup, emqx_rule_registry]}}
|
||||
]},
|
||||
{<<".*">>, []}
|
||||
],
|
||||
|
@ -19,13 +22,16 @@
|
|||
[ {load_module, emqx_rule_funcs, brutal_purge, soft_purge, []}
|
||||
, {load_module, emqx_rule_engine, brutal_purge, soft_purge, []}
|
||||
, {load_module, emqx_rule_registry, brutal_purge, soft_purge, []}
|
||||
, {apply, {supervisor, restart_child, [emqx_rule_engine_sup, emqx_rule_registry]}}
|
||||
]},
|
||||
{"4.3.1",
|
||||
[ {load_module, emqx_rule_engine, brutal_purge, soft_purge, []}
|
||||
, {load_module, emqx_rule_registry, brutal_purge, soft_purge, []}
|
||||
, {apply, {supervisor, restart_child, [emqx_rule_engine_sup, emqx_rule_registry]}}
|
||||
]},
|
||||
{"4.3.2",
|
||||
[ {load_module, emqx_rule_registry, brutal_purge, soft_purge, []}
|
||||
, {apply, {supervisor, restart_child, [emqx_rule_engine_sup, emqx_rule_registry]}}
|
||||
]},
|
||||
{<<".*">>, []}
|
||||
]
|
||||
|
|
|
@ -93,13 +93,6 @@
|
|||
|
||||
-define(REGISTRY, ?MODULE).
|
||||
|
||||
%% Statistics
|
||||
-define(STATS,
|
||||
[ {?RULE_TAB, 'rules.count', 'rules.max'}
|
||||
, {?ACTION_TAB, 'actions.count', 'actions.max'}
|
||||
, {?RES_TAB, 'resources.count', 'resources.max'}
|
||||
]).
|
||||
|
||||
-define(T_CALL, 10000).
|
||||
|
||||
%%------------------------------------------------------------------------------
|
||||
|
@ -442,8 +435,6 @@ delete_resource_type(Type) ->
|
|||
%%------------------------------------------------------------------------------
|
||||
|
||||
init([]) ->
|
||||
%% Enable stats timer
|
||||
ok = emqx_stats:update_interval(rule_registery_stats, fun update_stats/0),
|
||||
_TableId = ets:new(?KV_TAB, [named_table, set, public, {write_concurrency, true},
|
||||
{read_concurrency, true}]),
|
||||
{ok, #{}}.
|
||||
|
@ -469,7 +460,7 @@ handle_info(Info, State) ->
|
|||
{noreply, State}.
|
||||
|
||||
terminate(_Reason, _State) ->
|
||||
emqx_stats:cancel_update(rule_registery_stats).
|
||||
ok.
|
||||
|
||||
code_change(_OldVsn, State, _Extra) ->
|
||||
{ok, State}.
|
||||
|
@ -478,13 +469,6 @@ code_change(_OldVsn, State, _Extra) ->
|
|||
%% Private functions
|
||||
%%------------------------------------------------------------------------------
|
||||
|
||||
update_stats() ->
|
||||
lists:foreach(
|
||||
fun({Tab, Stat, MaxStat}) ->
|
||||
Size = mnesia:table_info(Tab, size),
|
||||
emqx_stats:setstat(Stat, MaxStat, Size)
|
||||
end, ?STATS).
|
||||
|
||||
get_all_records(Tab) ->
|
||||
%mnesia:dirty_match_object(Tab, mnesia:table_info(Tab, wild_pattern)).
|
||||
ets:tab2list(Tab).
|
||||
|
|
Loading…
Reference in New Issue