Add new metric 'channel.gc.cnt'
This commit is contained in:
parent
dfa2c2370e
commit
7b27d49a40
|
@ -134,10 +134,15 @@
|
||||||
{counter, 'messages.forward'} % Messages forward
|
{counter, 'messages.forward'} % Messages forward
|
||||||
]).
|
]).
|
||||||
|
|
||||||
|
-define(CHAN_METRICS, [
|
||||||
|
{counter, 'channel.gc.cnt'}
|
||||||
|
]).
|
||||||
|
|
||||||
-define(MQTT_METRICS, [
|
-define(MQTT_METRICS, [
|
||||||
{counter, 'auth.mqtt.anonymous'}
|
{counter, 'auth.mqtt.anonymous'}
|
||||||
]).
|
]).
|
||||||
|
|
||||||
|
|
||||||
-record(state, {next_idx = 1}).
|
-record(state, {next_idx = 1}).
|
||||||
|
|
||||||
-record(metric, {name, type, idx}).
|
-record(metric, {name, type, idx}).
|
||||||
|
@ -262,7 +267,7 @@ update_counter(Name, Value) ->
|
||||||
%%--------------------------------------------------------------------
|
%%--------------------------------------------------------------------
|
||||||
|
|
||||||
%% @doc Inc packets received.
|
%% @doc Inc packets received.
|
||||||
-spec(inc_recv(emqx_mqtt_types:packet()) -> ok).
|
-spec(inc_recv(emqx_types:packet()) -> ok).
|
||||||
inc_recv(Packet) ->
|
inc_recv(Packet) ->
|
||||||
inc('packets.received'),
|
inc('packets.received'),
|
||||||
do_inc_recv(Packet).
|
do_inc_recv(Packet).
|
||||||
|
@ -299,7 +304,7 @@ do_inc_recv(_Packet) ->
|
||||||
ignore.
|
ignore.
|
||||||
|
|
||||||
%% @doc Inc packets sent. Will not count $SYS PUBLISH.
|
%% @doc Inc packets sent. Will not count $SYS PUBLISH.
|
||||||
-spec(inc_sent(emqx_mqtt_types:packet()) -> ok | ignore).
|
-spec(inc_sent(emqx_types:packet()) -> ok | ignore).
|
||||||
inc_sent(?PUBLISH_PACKET(_QoS, <<"$SYS/", _/binary>>, _, _)) ->
|
inc_sent(?PUBLISH_PACKET(_QoS, <<"$SYS/", _/binary>>, _, _)) ->
|
||||||
ignore;
|
ignore;
|
||||||
inc_sent(Packet) ->
|
inc_sent(Packet) ->
|
||||||
|
@ -453,4 +458,5 @@ reserved_idx('messages.dropped') -> 49;
|
||||||
reserved_idx('messages.expired') -> 50;
|
reserved_idx('messages.expired') -> 50;
|
||||||
reserved_idx('messages.forward') -> 51;
|
reserved_idx('messages.forward') -> 51;
|
||||||
reserved_idx('auth.mqtt.anonymous') -> 52;
|
reserved_idx('auth.mqtt.anonymous') -> 52;
|
||||||
|
reserved_idx('channel.gc.cnt') -> 53;
|
||||||
reserved_idx(_) -> undefined.
|
reserved_idx(_) -> undefined.
|
||||||
|
|
Loading…
Reference in New Issue