aboutsummaryrefslogtreecommitdiff
path: root/src/mod_metrics.erl
diff options
context:
space:
mode:
authorEvgeny Khramtsov <ekhramtsov@process-one.net>2020-01-08 12:24:51 +0300
committerEvgeny Khramtsov <ekhramtsov@process-one.net>2020-01-08 12:24:51 +0300
commit97da380acd8e3ba0c9a9618a99c4106eca1d1576 (patch)
treecc2b8fb7e175afcaf182a3595735f6f9177ec3dc /src/mod_metrics.erl
parentUpdate deps (diff)
Generate ejabberd.yml.5 man page from source code directly
Several documentation callbacks (doc/0 and mod_doc/0) are implemented and `ejabberdctl man` command is added to generate a man page. Note that the command requires a2x to be installed (which is a part of asciidoc package).
Diffstat (limited to '')
-rw-r--r--src/mod_metrics.erl32
1 files changed, 31 insertions, 1 deletions
diff --git a/src/mod_metrics.erl b/src/mod_metrics.erl
index 297f3eeb5..ab6e214b1 100644
--- a/src/mod_metrics.erl
+++ b/src/mod_metrics.erl
@@ -30,9 +30,10 @@
-include("logger.hrl").
-include("xmpp.hrl").
+-include("translate.hrl").
-export([start/2, stop/1, mod_opt_type/1, mod_options/1, depends/2, reload/3]).
--export([push/2]).
+-export([push/2, mod_doc/0]).
-export([offline_message_hook/1,
sm_register_connection_hook/3, sm_remove_connection_hook/3,
user_send_packet/1, user_receive_packet/1,
@@ -188,3 +189,32 @@ mod_opt_type(port) ->
mod_options(_) ->
[{ip, {127,0,0,1}}, {port, 11111}].
+
+mod_doc() ->
+ #{desc =>
+ [?T("This module sends events to external backend "
+ "(by now only https://github.com/processone/grapherl"
+ "[grapherl] is supported). Supported events are:"), "",
+ "- sm_register_connection", "",
+ "- sm_remove_connection", "",
+ "- user_send_packet", "",
+ "- user_receive_packet", "",
+ "- s2s_send_packet", "",
+ "- s2s_receive_packet", "",
+ "- register_user", "",
+ "- remove_user", "",
+ "- offline_message", "",
+ ?T("When enabled, every call to these hooks triggers "
+ "a counter event to be sent to the external backend.")],
+ opts =>
+ [{ip,
+ #{value => ?T("IPv4Address"),
+ desc =>
+ ?T("IPv4 address where the backend is located. "
+ "The default value is '127.0.0.1'.")}},
+ {port,
+ #{value => ?T("Port"),
+ desc =>
+ ?T("An internet port number at which the backend "
+ "is listening for incoming connections/packets. "
+ "The default value is '11111'.")}}]}.