fix route, reverse_route stats

This commit is contained in:
Feng 2016-01-17 20:02:44 +08:00
parent 4f9d429478
commit 51c5ea1f96
1 changed files with 7 additions and 1 deletions

View File

@ -34,7 +34,7 @@
-define(CONCURRENCY_OPTS, [{read_concurrency, true}, {write_concurrency, true}]).
%% API
-export([start_link/0]).
-export([start_link/0, pubsub_pool/0]).
%% Supervisor callbacks
-export([init/1]).
@ -42,6 +42,9 @@
start_link() ->
supervisor:start_link({local, ?MODULE}, ?MODULE, [emqttd_broker:env(pubsub)]).
pubsub_pool() ->
hd([Pid|| {pubsub_pool, Pid, _, _} <- supervisor:which_children(?MODULE)]).
init([Env]) ->
%% Create tabs
create_tab(route), create_tab(reverse_route),
@ -83,6 +86,9 @@ pool_size(Env) ->
setstats(route) ->
emqttd_stats:setstat('routes/count', ets:info(route, size));
setstats(reverse_route) ->
emqttd_stats:setstat('routes/reverse', ets:info(reverse_route, size));
setstats(topic) ->
emqttd_stats:setstats('topics/count', 'topics/max', mnesia:table_info(topic, size));