1 |
|
-module(mongoose_module_metrics). |
2 |
|
|
3 |
|
-export([opts_for_module/3]). |
4 |
|
|
5 |
|
-ignore_xref([behaviour_info/1]). |
6 |
|
|
7 |
|
-callback config_metrics(mongooseim:host_type()) -> any(). |
8 |
|
|
9 |
|
-optional_callbacks([config_metrics/1]). |
10 |
|
|
11 |
|
-spec opts_for_module(mongooseim:host_type(), module(), list()) -> list(). |
12 |
|
opts_for_module(HostType, Module, OptsToReport) -> |
13 |
689 |
try |
14 |
689 |
Opts = gen_mod:get_module_opts(HostType, Module), |
15 |
689 |
[get_opt(OptToReport, Opts) || OptToReport <- OptsToReport] |
16 |
|
catch |
17 |
226 |
_:_ -> [{none, none}] |
18 |
|
end. |
19 |
|
|
20 |
|
get_opt({Opt, DefaultValue}, Opts) -> |
21 |
|
% Deprecated, defaults should be specified in the config spec |
22 |
:-( |
{Opt, gen_mod:get_opt(Opt, Opts, DefaultValue)}; |
23 |
|
get_opt(Opt, Opts) -> |
24 |
689 |
{Opt, gen_mod:get_opt(Opt, Opts)}. |