feat: support emqx_conf:update([telemetry],Conf).

This commit is contained in:
某文 2023-05-28 22:54:35 +08:00
parent c2450d230d
commit 8ccee19aa5
1 changed files with 8 additions and 1 deletions

View File

@ -53,7 +53,9 @@ set_telemetry_status(Status) ->
end.
pre_config_update(_, {set_telemetry_status, Status}, RawConf) ->
{ok, RawConf#{<<"enable">> => Status}}.
{ok, RawConf#{<<"enable">> => Status}};
pre_config_update(_, NewConf, _OldConf) ->
{ok, NewConf}.
post_config_update(
_,
@ -65,6 +67,11 @@ post_config_update(
case Status of
true -> emqx_telemetry:start_reporting();
false -> emqx_telemetry:stop_reporting()
end;
post_config_update(_, _UpdateReq, NewConf, _OldConf, _AppEnvs) ->
case NewConf of
#{enable := true} -> emqx_telemetry:start_reporting();
#{enable := false} -> emqx_telemetry:stop_reporting()
end.
cfg_update(Path, Action, Params) ->