diff --git a/src/emqx_stats.erl b/src/emqx_stats.erl index bec56f142..771069704 100644 --- a/src/emqx_stats.erl +++ b/src/emqx_stats.erl @@ -73,6 +73,8 @@ -define(PUBSUB_STATS, [ 'topics/count', 'topics/max', + 'suboptions/count', + 'suboptions/max', 'subscribers/count', 'subscribers/max', 'subscriptions/count', @@ -242,9 +244,12 @@ code_change(_OldVsn, State, _Extra) -> %%------------------------------------------------------------------------------ safe_update_element(Key, Val) -> - try ets:update_element(?TAB, Key, {2, Val}) + try ets:update_element(?TAB, Key, {2, Val}) of + false -> + ets:insert_new(?TAB, {Key, Val}); + true -> + true catch error:badarg -> - ets:insert_new(?TAB, {Key, Val}) + ?LOG(warning, "[Stats] Update ~p to ~p failed", [Key, Val]) end. -