Add suboptions for stats (#2507)
This commit is contained in:
parent
0ea6697a57
commit
b4c659fb54
|
@ -73,6 +73,8 @@
|
||||||
-define(PUBSUB_STATS, [
|
-define(PUBSUB_STATS, [
|
||||||
'topics/count',
|
'topics/count',
|
||||||
'topics/max',
|
'topics/max',
|
||||||
|
'suboptions/count',
|
||||||
|
'suboptions/max',
|
||||||
'subscribers/count',
|
'subscribers/count',
|
||||||
'subscribers/max',
|
'subscribers/max',
|
||||||
'subscriptions/count',
|
'subscriptions/count',
|
||||||
|
@ -242,9 +244,12 @@ code_change(_OldVsn, State, _Extra) ->
|
||||||
%%------------------------------------------------------------------------------
|
%%------------------------------------------------------------------------------
|
||||||
|
|
||||||
safe_update_element(Key, Val) ->
|
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
|
catch
|
||||||
error:badarg ->
|
error:badarg ->
|
||||||
ets:insert_new(?TAB, {Key, Val})
|
?LOG(warning, "[Stats] Update ~p to ~p failed", [Key, Val])
|
||||||
end.
|
end.
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue