fix: some API code format & api doc code format (#5601)

This commit is contained in:
DDDHuang 2021-08-30 16:41:00 +08:00 committed by GitHub
parent 100e550491
commit 5b75fdd120
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 164 additions and 447 deletions

View File

@ -78,143 +78,64 @@ schemas() ->
Client = #{ Client = #{
client => #{ client => #{
type => object, type => object,
properties => #{ properties => emqx_mgmt_util:properties(properties(client))
node => #{
type => string,
description => <<"Name of the node to which the client is connected">>},
clientid => #{
type => string,
description => <<"Client identifier">>},
username => #{
type => string,
description => <<"User name of client when connecting">>},
proto_name => #{
type => string,
description => <<"Client protocol name">>},
proto_ver => #{
type => integer,
description => <<"Protocol version used by the client">>},
ip_address => #{
type => string,
description => <<"Client's IP address">>},
is_bridge => #{
type => boolean,
description => <<"Indicates whether the client is connectedvia bridge">>},
connected_at => #{
type => string,
description => <<"Client connection time">>},
disconnected_at => #{
type => string,
description => <<"Client offline time, This field is only valid and returned when connected is false">>},
connected => #{
type => boolean,
description => <<"Whether the client is connected">>},
will_msg => #{
type => string,
description => <<"Client will message">>},
zone => #{
type => string,
description => <<"Indicate the configuration group used by the client">>},
keepalive => #{
type => integer,
description => <<"keepalive time, with the unit of second">>},
clean_start => #{
type => boolean,
description => <<"Indicate whether the client is using a brand new session">>},
expiry_interval => #{
type => integer,
description => <<"Session expiration interval, with the unit of second">>},
created_at => #{
type => string,
description => <<"Session creation time">>},
subscriptions_cnt => #{
type => integer,
description => <<"Number of subscriptions established by this client.">>},
subscriptions_max => #{
type => integer,
description => <<"v4 api name [max_subscriptions] Maximum number of subscriptions allowed by this client">>},
inflight_cnt => #{
type => integer,
description => <<"Current length of inflight">>},
inflight_max => #{
type => integer,
description => <<"v4 api name [max_inflight]. Maximum length of inflight">>},
mqueue_len => #{
type => integer,
description => <<"Current length of message queue">>},
mqueue_max => #{
type => integer,
description => <<"v4 api name [max_mqueue]. Maximum length of message queue">>},
mqueue_dropped => #{
type => integer,
description => <<"Number of messages dropped by the message queue due to exceeding the length">>},
awaiting_rel_cnt => #{
type => integer,
description => <<"v4 api name [awaiting_rel] Number of awaiting PUBREC packet">>},
awaiting_rel_max => #{
type => integer,
description => <<"v4 api name [max_awaiting_rel]. Maximum allowed number of awaiting PUBREC packet">>},
recv_oct => #{
type => integer,
description => <<"Number of bytes received by EMQ X Broker (the same below)">>},
recv_cnt => #{
type => integer,
description => <<"Number of TCP packets received">>},
recv_pkt => #{
type => integer,
description => <<"Number of MQTT packets received">>},
recv_msg => #{
type => integer,
description => <<"Number of PUBLISH packets received">>},
send_oct => #{
type => integer,
description => <<"Number of bytes sent">>},
send_cnt => #{
type => integer,
description => <<"Number of TCP packets sent">>},
send_pkt => #{
type => integer,
description => <<"Number of MQTT packets sent">>},
send_msg => #{
type => integer,
description => <<"Number of PUBLISH packets sent">>},
mailbox_len => #{
type => integer,
description => <<"Process mailbox size">>},
heap_size => #{
type => integer,
description => <<"Process heap size with the unit of byte">>
},
reductions => #{
type => integer,
description => <<"Erlang reduction">>}
}
} }
}, },
AuthzCache = #{ AuthzCache = #{
authz_cache => #{ authz_cache => #{
type => object, type => object,
properties => #{ properties => emqx_mgmt_util:properties(properties(authz_cache))
topic => #{
type => string,
description => <<"Topic name">>},
access => #{
type => string,
enum => [<<"subscribe">>, <<"publish">>],
description => <<"Access type">>},
result => #{
type => string,
enum => [<<"allow">>, <<"deny">>],
default => <<"allow">>,
description => <<"Allow or deny">>},
updated_time => #{
type => integer,
description => <<"Update time">>}
}
} }
}, },
[Client, AuthzCache]. [Client, AuthzCache].
properties(client) ->
[
{awaiting_rel_cnt, integer, <<"v4 api name [awaiting_rel] Number of awaiting PUBREC packet">>},
{awaiting_rel_max, integer, <<"v4 api name [max_awaiting_rel]. Maximum allowed number of awaiting PUBREC packet">>},
{clean_start, boolean, <<"Indicate whether the client is using a brand new session">>},
{clientid, string , <<"Client identifier">>},
{connected, boolean, <<"Whether the client is connected">>},
{connected_at, string , <<"Client connection time">>},
{created_at, string , <<"Session creation time">>},
{disconnected_at, string , <<"Client offline time, This field is only valid and returned when connected is false">>},
{expiry_interval, integer, <<"Session expiration interval, with the unit of second">>},
{heap_size, integer, <<"Process heap size with the unit of byte">>},
{inflight_cnt, integer, <<"Current length of inflight">>},
{inflight_max, integer, <<"v4 api name [max_inflight]. Maximum length of inflight">>},
{ip_address, string , <<"Client's IP address">>},
{is_bridge, boolean, <<"Indicates whether the client is connectedvia bridge">>},
{keepalive, integer, <<"keepalive time, with the unit of second">>},
{mailbox_len, integer, <<"Process mailbox size">>},
{mqueue_dropped, integer, <<"Number of messages dropped by the message queue due to exceeding the length">>},
{mqueue_len, integer, <<"Current length of message queue">>},
{mqueue_max, integer, <<"v4 api name [max_mqueue]. Maximum length of message queue">>},
{node, string , <<"Name of the node to which the client is connected">>},
{proto_name, string , <<"Client protocol name">>},
{proto_ver, integer, <<"Protocol version used by the client">>},
{recv_cnt, integer, <<"Number of TCP packets received">>},
{recv_msg, integer, <<"Number of PUBLISH packets received">>},
{recv_oct, integer, <<"Number of bytes received by EMQ X Broker (the same below)">>},
{recv_pkt, integer, <<"Number of MQTT packets received">>},
{reductions, integer, <<"Erlang reduction">>},
{send_cnt, integer, <<"Number of TCP packets sent">>},
{send_msg, integer, <<"Number of PUBLISH packets sent">>},
{send_oct, integer, <<"Number of bytes sent">>},
{send_pkt, integer, <<"Number of MQTT packets sent">>},
{subscriptions_cnt, integer, <<"Number of subscriptions established by this client.">>},
{subscriptions_max, integer, <<"v4 api name [max_subscriptions] Maximum number of subscriptions allowed by this client">>},
{username, string , <<"User name of client when connecting">>},
{will_msg, string , <<"Client will message">>},
{zone, string , <<"Indicate the configuration group used by the client">>}
];
properties(authz_cache) ->
[
{access, string, <<"Access type">>},
{result, string, <<"Allow or deny">>},
{topic, string, <<"Topic name">>},
{updated_time, integer, <<"Update time">>}
].
clients_api() -> clients_api() ->
Metadata = #{ Metadata = #{
get => #{ get => #{

View File

@ -28,271 +28,107 @@ api_spec() ->
metrics_schema() -> metrics_schema() ->
Metric = #{ Metric = #{
type => object, type => object,
properties => properties() properties => emqx_mgmt_util:properties(properties())
}, },
Metrics = #{ Metrics = #{
type => array, type => array,
items => #{ items => #{
type => object, type => object,
properties => properties() properties => emqx_mgmt_util:properties([{node, string} | properties()])
} }
}, },
MetricsInfo = #{ MetricsInfo = #{
oneOf => [ minirest:ref(<<"metric">>) oneOf => [ minirest:ref(metric)
, minirest:ref(<<"metrics">>) , minirest:ref(metrics)
] ]
}, },
#{metric => Metric, metrics => Metrics, metrics_info => MetricsInfo}. #{metric => Metric, metrics => Metrics, metrics_info => MetricsInfo}.
properties() -> properties() ->
#{ [
'actions.failure' => #{ {'actions.failure', integer, <<"Number of failure executions of the rule engine action">>},
type => integer, {'actions.success', integer, <<"Number of successful executions of the rule engine action">>},
description => <<"Number of failure executions of the rule engine action">>}, {'bytes.received', integer, <<"Number of bytes received by EMQ X Broker">>},
'actions.success' => #{ {'bytes.sent', integer, <<"Number of bytes sent by EMQ X Broker on this connection">>},
type => integer, {'client.auth.anonymous', integer, <<"Number of clients who log in anonymously">>},
description => <<"Number of successful executions of the rule engine action">>}, {'client.authenticate', integer, <<"Number of client authentications">>},
'bytes.received' => #{ {'client.check_authz', integer, <<"Number of Authorization rule checks">>},
type => integer, {'client.connack', integer, <<"Number of CONNACK packet sent">>},
description => <<"Number of bytes received by EMQ X Broker">>}, {'client.connect', integer, <<"Number of client connections">>},
'bytes.sent' => #{ {'client.connected', integer, <<"Number of successful client connections">>},
type => integer, {'client.disconnected', integer, <<"Number of client disconnects">>},
description => <<"Number of bytes sent by EMQ X Broker on this connection">>}, {'client.subscribe', integer, <<"Number of client subscriptions">>},
'client.authenticate' => #{ {'client.unsubscribe', integer, <<"Number of client unsubscriptions">>},
type => integer, {'delivery.dropped', integer, <<"Total number of discarded messages when sending">>},
description => <<"Number of client authentications">>}, {'delivery.dropped.expired', integer, <<"Number of messages dropped due to message expiration on sending">>},
'client.auth.anonymous' => #{ {'delivery.dropped.no_local', integer, <<"Number of messages that were dropped due to the No Local subscription option when sending">>},
type => integer, {'delivery.dropped.qos0_msg', integer, <<"Number of messages with QoS 0 that were dropped because the message queue was full when sending">>},
description => <<"Number of clients who log in anonymously">>}, {'delivery.dropped.queue_full', integer, <<"Number of messages with a non-zero QoS that were dropped because the message queue was full when sending">>},
'client.connect' => #{ {'delivery.dropped.too_large', integer, <<"The number of messages that were dropped because the length exceeded the limit when sending">>},
type => integer, {'messages.acked', integer, <<"Number of received PUBACK and PUBREC packet">>},
description => <<"Number of client connections">>}, {'messages.delayed', integer, <<"Number of delay- published messages stored by EMQ X Broker">>},
'client.connack' => #{ {'messages.delivered', integer, <<"Number of messages forwarded to the subscription process internally by EMQ X Broker">>},
type => integer, {'messages.dropped', integer, <<"Total number of messages dropped by EMQ X Broker before forwarding to the subscription process">>},
description => <<"Number of CONNACK packet sent">>}, {'messages.dropped.expired', integer, <<"Number of messages dropped due to message expiration when receiving">>},
'client.connected' => #{ {'messages.dropped.no_subscribers', integer, <<"Number of messages dropped due to no subscribers">>},
type => integer, {'messages.forward', integer, <<"Number of messages forwarded to other nodes">>},
description => <<"Number of successful client connections">>}, {'messages.publish', integer, <<"Number of messages published in addition to system messages">>},
'client.disconnected' => #{ {'messages.qos0.received', integer, <<"Number of QoS 0 messages received from clients">>},
type => integer, {'messages.qos0.sent', integer, <<"Number of QoS 0 messages sent to clients">>},
description => <<"Number of client disconnects">>}, {'messages.qos1.received', integer, <<"Number of QoS 1 messages received from clients">>},
'client.check_authz' => #{ {'messages.qos1.sent', integer, <<"Number of QoS 1 messages sent to clients">>},
type => integer, {'messages.qos2.received', integer, <<"Number of QoS 2 messages received from clients">>},
description => <<"Number of Authorization rule checks">>}, {'messages.qos2.sent', integer, <<"Number of QoS 2 messages sent to clients">>},
'client.subscribe' => #{ {'messages.received', integer, <<"Number of messages received from the client, equal to the sum of messages.qos0.received\fmessages.qos1.received and messages.qos2.received">>},
type => integer, {'messages.retained', integer, <<"Number of retained messages stored by EMQ X Broker">>},
description => <<"Number of client subscriptions">>}, {'messages.sent', integer, <<"Number of messages sent to the client, equal to the sum of messages.qos0.sent\fmessages.qos1.sent and messages.qos2.sent">>},
'client.unsubscribe' => #{ {'packets.auth.received', integer, <<"Number of received AUTH packet">>},
type => integer, {'packets.auth.sent', integer, <<"Number of sent AUTH packet">>},
description => <<"Number of client unsubscriptions">>}, {'packets.connack.auth_error', integer, <<"Number of received CONNECT packet with failed authentication">>},
'delivery.dropped.too_large' => #{ {'packets.connack.error', integer, <<"Number of received CONNECT packet with unsuccessful connections">>},
type => integer, {'packets.connack.sent', integer, <<"Number of sent CONNACK packet">>},
description => <<"The number of messages that were dropped because the length exceeded the limit when sending">>}, {'packets.connect.received', integer, <<"Number of received CONNECT packet">>},
'delivery.dropped.queue_full' => #{ {'packets.disconnect.received', integer, <<"Number of received DISCONNECT packet">>},
type => integer, {'packets.disconnect.sent', integer, <<"Number of sent DISCONNECT packet">>},
description => <<"Number of messages with a non-zero QoS that were dropped because the message queue was full when sending">>}, {'packets.pingreq.received', integer, <<"Number of received PINGREQ packet">>},
'delivery.dropped.qos0_msg' => #{ {'packets.pingresp.sent', integer, <<"Number of sent PUBRESP packet">>},
type => integer, {'packets.puback.inuse', integer, <<"Number of received PUBACK packet with occupied identifiers">>},
description => <<"Number of messages with QoS 0 that were dropped because the message queue was full when sending">>}, {'packets.puback.missed', integer, <<"Number of received packet with identifiers.">>},
'delivery.dropped.expired' => #{ {'packets.puback.received', integer, <<"Number of received PUBACK packet">>},
type => integer, {'packets.puback.sent', integer, <<"Number of sent PUBACK packet">>},
description => <<"Number of messages dropped due to message expiration on sending">>}, {'packets.pubcomp.inuse', integer, <<"Number of received PUBCOMP packet with occupied identifiers">>},
'delivery.dropped.no_local' => #{ {'packets.pubcomp.missed', integer, <<"Number of missed PUBCOMP packet">>},
type => integer, {'packets.pubcomp.received', integer, <<"Number of received PUBCOMP packet">>},
description => <<"Number of messages that were dropped due to the No Local subscription option when sending">>}, {'packets.pubcomp.sent', integer, <<"Number of sent PUBCOMP packet">>},
'delivery.dropped' => #{ {'packets.publish.auth_error', integer, <<"Number of received PUBLISH packets with failed the Authorization check">>},
type => integer, {'packets.publish.dropped', integer, <<"Number of messages discarded due to the receiving limit">>},
description => <<"Total number of discarded messages when sending">>}, {'packets.publish.error', integer, <<"Number of received PUBLISH packet that cannot be published">>},
'messages.delayed' => #{ {'packets.publish.inuse', integer, <<"Number of received PUBLISH packet with occupied identifiers">>},
type => integer, {'packets.publish.received', integer, <<"Number of received PUBLISH packet">>},
description => <<"Number of delay- published messages stored by EMQ X Broker">>}, {'packets.publish.sent', integer, <<"Number of sent PUBLISH packet">>},
'messages.delivered' => #{ {'packets.pubrec.inuse', integer, <<"Number of received PUBREC packet with occupied identifiers">>},
type => integer, {'packets.pubrec.missed', integer, <<"Number of received PUBREC packet with unknown identifiers">>},
description => <<"Number of messages forwarded to the subscription process internally by EMQ X Broker">>}, {'packets.pubrec.received', integer, <<"Number of received PUBREC packet">>},
'messages.dropped' => #{ {'packets.pubrec.sent', integer, <<"Number of sent PUBREC packet">>},
type => integer, {'packets.pubrel.missed', integer, <<"Number of received PUBREC packet with unknown identifiers">>},
description => <<"Total number of messages dropped by EMQ X Broker before forwarding to the subscription process">>}, {'packets.pubrel.received', integer, <<"Number of received PUBREL packet">>},
'messages.dropped.expired' => #{ {'packets.pubrel.sent', integer, <<"Number of sent PUBREL packet">>},
type => integer, {'packets.received', integer, <<"Number of received packet">>},
description => <<"Number of messages dropped due to message expiration when receiving">>}, {'packets.sent', integer, <<"Number of sent packet">>},
'messages.dropped.no_subscribers' => #{ {'packets.suback.sent', integer, <<"Number of sent SUBACK packet">>},
type => integer, {'packets.subscribe.auth_error', integer, <<"Number of received SUBACK packet with failed Authorization check">>},
description => <<"Number of messages dropped due to no subscribers">>}, {'packets.subscribe.error', integer, <<"Number of received SUBSCRIBE packet with failed subscriptions">>},
'messages.forward' => #{ {'packets.subscribe.received', integer, <<"Number of received SUBSCRIBE packet">>},
type => integer, {'packets.unsuback.sent', integer, <<"Number of sent UNSUBACK packet">>},
description => <<"Number of messages forwarded to other nodes">>}, {'packets.unsubscribe.error', integer, <<"Number of received UNSUBSCRIBE packet with failed unsubscriptions">>},
'messages.publish' => #{ {'packets.unsubscribe.received', integer, <<"Number of received UNSUBSCRIBE packet">>},
type => integer, {'rules.matched', integer, <<"Number of rule matched">>},
description => <<"Number of messages published in addition to system messages">>}, {'session.created', integer, <<"Number of sessions created">>},
'messages.qos0.received' => #{ {'session.discarded', integer, <<"Number of sessions dropped because Clean Session or Clean Start is true">>},
type => integer, {'session.resumed', integer, <<"Number of sessions resumed because Clean Session or Clean Start is false">>},
description => <<"Number of QoS 0 messages received from clients">>}, {'session.takeovered', integer, <<"Number of sessions takeovered because Clean Session or Clean Start is false">>},
'messages.qos1.received' => #{ {'session.terminated', integer, <<"Number of terminated sessions">>}
type => integer, ].
description => <<"Number of QoS 1 messages received from clients">>},
'messages.qos2.received' => #{
type => integer,
description => <<"Number of QoS 2 messages received from clients">>},
'messages.qos0.sent' => #{
type => integer,
description => <<"Number of QoS 0 messages sent to clients">>},
'messages.qos1.sent' => #{
type => integer,
description => <<"Number of QoS 1 messages sent to clients">>},
'messages.qos2.sent' => #{
type => integer,
description => <<"Number of QoS 2 messages sent to clients">>},
'messages.received' => #{
type => integer,
description => <<"Number of messages received from the client, equal to the sum of messages.qos0.receivedmessages.qos1.received and messages.qos2.received">>},
'messages.sent' => #{
type => integer,
description => <<"Number of messages sent to the client, equal to the sum of messages.qos0.sentmessages.qos1.sent and messages.qos2.sent">>},
'messages.retained' => #{
type => integer,
description => <<"Number of retained messages stored by EMQ X Broker">>},
'messages.acked' => #{
type => integer,
description => <<"Number of received PUBACK and PUBREC packet">>},
'packets.received' => #{
type => integer,
description => <<"Number of received packet">>},
'packets.sent' => #{
type => integer,
description => <<"Number of sent packet">>},
'packets.connect.received' => #{
type => integer,
description => <<"Number of received CONNECT packet">>},
'packets.connack.auth_error' => #{
type => integer,
description => <<"Number of received CONNECT packet with failed authentication">>},
'packets.connack.error' => #{
type => integer,
description => <<"Number of received CONNECT packet with unsuccessful connections">>},
'packets.connack.sent' => #{
type => integer,
description => <<"Number of sent CONNACK packet">>},
'packets.publish.received' => #{
type => integer,
description => <<"Number of received PUBLISH packet">>},
'packets.publish.sent' => #{
type => integer,
description => <<"Number of sent PUBLISH packet">>},
'packets.publish.inuse' => #{
type => integer,
description => <<"Number of received PUBLISH packet with occupied identifiers">>},
'packets.publish.auth_error' => #{
type => integer,
description => <<"Number of received PUBLISH packets with failed the Authorization check">>},
'packets.publish.error' => #{
type => integer,
description => <<"Number of received PUBLISH packet that cannot be published">>},
'packets.publish.dropped' => #{
type => integer,
description => <<"Number of messages discarded due to the receiving limit">>},
'packets.puback.received' => #{
type => integer,
description => <<"Number of received PUBACK packet">>},
'packets.puback.sent' => #{
type => integer,
description => <<"Number of sent PUBACK packet">>},
'packets.puback.inuse' => #{
type => integer,
description => <<"Number of received PUBACK packet with occupied identifiers">>},
'packets.puback.missed' => #{
type => integer,
description => <<"Number of received packet with identifiers.">>},
'packets.pubrec.received' => #{
type => integer,
description => <<"Number of received PUBREC packet">>},
'packets.pubrec.sent' => #{
type => integer,
description => <<"Number of sent PUBREC packet">>},
'packets.pubrec.inuse' => #{
type => integer,
description => <<"Number of received PUBREC packet with occupied identifiers">>},
'packets.pubrec.missed' => #{
type => integer,
description => <<"Number of received PUBREC packet with unknown identifiers">>},
'packets.pubrel.received' => #{
type => integer,
description => <<"Number of received PUBREL packet">>},
'packets.pubrel.sent' => #{
type => integer,
description => <<"Number of sent PUBREL packet">>},
'packets.pubrel.missed' => #{
type => integer,
description => <<"Number of received PUBREC packet with unknown identifiers">>},
'packets.pubcomp.received' => #{
type => integer,
description => <<"Number of received PUBCOMP packet">>},
'packets.pubcomp.sent' => #{
type => integer,
description => <<"Number of sent PUBCOMP packet">>},
'packets.pubcomp.inuse' => #{
type => integer,
description => <<"Number of received PUBCOMP packet with occupied identifiers">>},
'packets.pubcomp.missed' => #{
type => integer,
description => <<"Number of missed PUBCOMP packet">>},
'packets.subscribe.received' => #{
type => integer,
description => <<"Number of received SUBSCRIBE packet">>},
'packets.subscribe.error' => #{
type => integer,
description => <<"Number of received SUBSCRIBE packet with failed subscriptions">>},
'packets.subscribe.auth_error' => #{
type => integer,
description => <<"Number of received SUBACK packet with failed Authorization check">>},
'packets.suback.sent' => #{
type => integer,
description => <<"Number of sent SUBACK packet">>},
'packets.unsubscribe.received' => #{
type => integer,
description => <<"Number of received UNSUBSCRIBE packet">>},
'packets.unsubscribe.error' => #{
type => integer,
description => <<"Number of received UNSUBSCRIBE packet with failed unsubscriptions">>},
'packets.unsuback.sent' => #{
type => integer,
description => <<"Number of sent UNSUBACK packet">>},
'packets.pingreq.received' => #{
type => integer,
description => <<"Number of received PINGREQ packet">>},
'packets.pingresp.sent' => #{
type => integer,
description => <<"Number of sent PUBRESP packet">>},
'packets.disconnect.received' => #{
type => integer,
description => <<"Number of received DISCONNECT packet">>},
'packets.disconnect.sent' => #{
type => integer,
description => <<"Number of sent DISCONNECT packet">>},
'packets.auth.received' => #{
type => integer,
description => <<"Number of received AUTH packet">>},
'packets.auth.sent' => #{
type => integer,
description => <<"Number of sent AUTH packet">>},
'rules.matched' => #{
type => integer,
description => <<"Number of rule matched">>},
'session.created' => #{
type => integer,
description => <<"Number of sessions created">>},
'session.discarded' => #{
type => integer,
description => <<"Number of sessions dropped because Clean Session or Clean Start is true">>},
'session.resumed' => #{
type => integer,
description => <<"Number of sessions resumed because Clean Session or Clean Start is false">>},
'session.takeovered' => #{
type => integer,
description => <<"Number of sessions takeovered because Clean Session or Clean Start is false">>},
'session.terminated' => #{
type => integer,
description => <<"Number of terminated sessions">>}
}.
metrics_api() -> metrics_api() ->
Metadata = #{ Metadata = #{

View File

@ -29,83 +29,43 @@ stats_schema() ->
type => array, type => array,
items => #{ items => #{
type => object, type => object,
properties => maps:put('node', #{type => string, description => <<"Node">>}, properties()) properties => emqx_mgmt_util:properties([{'node', string} | properties()])
} }
}, },
Stat = #{ Stat = #{
type => object, type => object,
properties => properties() properties => emqx_mgmt_util:properties(properties())
}, },
StatsInfo =#{ StatsInfo =#{
oneOf => [ minirest:ref(<<"stats">>) oneOf => [ minirest:ref(stats)
, minirest:ref(<<"stat">>) , minirest:ref(stat)
] ]
}, },
[#{stats => Stats, stat => Stat, stats_info => StatsInfo}]. [#{stats => Stats, stat => Stat, stats_info => StatsInfo}].
properties() -> properties() ->
#{ [
'connections.count' => #{ {'channels.count', integer, <<"sessions.count">>},
type => integer, {'channels.max', integer, <<"session.max">>},
description => <<"Number of current connections">>}, {'connections.count', integer, <<"Number of current connections">>},
'connections.max' => #{ {'connections.max', integer, <<"Historical maximum number of connections">>},
type => integer, {'retained.count', integer, <<"Number of currently retained messages">>},
description => <<"Historical maximum number of connections">>}, {'retained.max', integer, <<"Historical maximum number of retained messages">>},
'channels.count' => #{ {'routes.count', integer, <<"Number of current routes">>},
type => integer, {'routes.max', integer, <<"Historical maximum number of routes">>},
description => <<"sessions.count">>}, {'sessions.count', integer, <<"Number of current sessions">>},
'channels.max' => #{ {'sessions.max', integer, <<"Historical maximum number of sessions">>},
type => integer, {'suboptions.count', integer, <<"subscriptions.count">>},
description => <<"session.max">>}, {'suboptions.max', integer, <<"subscriptions.max">>},
'sessions.count' => #{ {'subscribers.count', integer, <<"Number of current subscribers">>},
type => integer, {'subscribers.max', integer, <<"Historical maximum number of subscribers">>},
description => <<"Number of current sessions">>}, {'subscriptions.count', integer, <<"Number of current subscriptions, including shared subscriptions">>},
'sessions.max' => #{ {'subscriptions.max', integer, <<"Historical maximum number of subscriptions">>},
type => integer, {'subscriptions.shared.count', integer, <<"Number of current shared subscriptions">>},
description => <<"Historical maximum number of sessions">>}, {'subscriptions.shared.max', integer, <<"Historical maximum number of shared subscriptions">>},
'topics.count' => #{ {'topics.count', integer, <<"Number of current topics">>},
type => integer, {'topics.max', integer, <<"Historical maximum number of topics">>}
description => <<"Number of current topics">>}, ].
'topics.max' => #{
type => integer,
description => <<"Historical maximum number of topics">>},
'suboptions.count' => #{
type => integer,
description => <<"subscriptions.count">>},
'suboptions.max' => #{
type => integer,
description => <<"subscriptions.max">>},
'subscribers.count' => #{
type => integer,
description => <<"Number of current subscribers">>},
'subscribers.max' => #{
type => integer,
description => <<"Historical maximum number of subscribers">>},
'subscriptions.count' => #{
type => integer,
description => <<"Number of current subscriptions, including shared subscriptions">>},
'subscriptions.max' => #{
type => integer,
description => <<"Historical maximum number of subscriptions">>},
'subscriptions.shared.count' => #{
type => integer,
description => <<"Number of current shared subscriptions">>},
'subscriptions.shared.max' => #{
type => integer,
description => <<"Historical maximum number of shared subscriptions">>},
'routes.count' => #{
type => integer,
description => <<"Number of current routes">>},
'routes.max' => #{
type => integer,
description => <<"Historical maximum number of routes">>},
'retained.count' => #{
type => integer,
description => <<"Number of currently retained messages">>},
'retained.max' => #{
type => integer,
description => <<"Historical maximum number of retained messages">>}
}.
stats_api() -> stats_api() ->
Metadata = #{ Metadata = #{