|
3 | 3 | -include("mongoose.hrl").
|
4 | 4 |
|
5 | 5 | -behaviour(mongoose_listener).
|
6 |
| --export([listener_spec/1, instrumentation/1]). |
| 6 | +-export([listener_spec/1]). |
7 | 7 |
|
8 | 8 | -behaviour(ranch_protocol).
|
9 | 9 | -export([start_link/3]).
|
10 | 10 |
|
11 | 11 | %% Hook handlers
|
12 | 12 | -export([handle_user_open_session/3]).
|
13 | 13 |
|
14 |
| --export([instrumentation/0]). |
15 |
| --ignore_xref([instrumentation/0]). |
16 |
| - |
17 |
| --spec instrumentation(_) -> [mongoose_instrument:spec()]. |
18 |
| -instrumentation(_) -> |
19 |
| - lists:foldl(fun instrumentation/2, instrumentation(), ?ALL_HOST_TYPES). |
20 |
| - |
21 |
| --spec instrumentation() -> [mongoose_instrument:spec()]. |
22 |
| -instrumentation() -> |
23 |
| - [{tcp_data_in, #{connection_type => c2s}, #{metrics => #{byte_size => spiral}}}, |
24 |
| - {tcp_data_out, #{connection_type => c2s}, #{metrics => #{byte_size => spiral}}}, |
25 |
| - {tls_data_in, #{connection_type => c2s}, #{metrics => #{byte_size => spiral}}}, |
26 |
| - {tls_data_out, #{connection_type => c2s}, #{metrics => #{byte_size => spiral}}}, |
27 |
| - {xmpp_element_size_out, #{connection_type => c2s}, #{metrics => #{byte_size => histogram}}}, |
28 |
| - {xmpp_element_size_in, #{connection_type => c2s}, #{metrics => #{byte_size => histogram}}}]. |
29 |
| - |
30 |
| --spec instrumentation(_, _) -> [mongoose_instrument:spec()]. |
31 |
| -instrumentation(HostType, Acc) when is_binary(HostType) -> |
32 |
| - [{c2s_message_processed, #{host_type => HostType}, |
33 |
| - #{metrics => #{time => histogram}}}, |
34 |
| - {c2s_auth_failed, #{host_type => HostType}, |
35 |
| - #{metrics => #{count => spiral}}}, |
36 |
| - {c2s_element_in, #{host_type => HostType}, |
37 |
| - #{metrics => maps:from_list([{Metric, spiral} || Metric <- mongoose_listener:element_spirals()])}}, |
38 |
| - {c2s_element_out, #{host_type => HostType}, |
39 |
| - #{metrics => maps:from_list([{Metric, spiral} || Metric <- mongoose_listener:element_spirals()])}} | Acc]. |
40 |
| - |
41 | 14 | %% mongoose_listener
|
42 | 15 | -spec listener_spec(mongoose_listener:options()) -> supervisor:child_spec().
|
43 | 16 | listener_spec(Opts) ->
|
|
0 commit comments