diff --git a/README.md b/README.md index ac14658..cbbcdcf 100644 --- a/README.md +++ b/README.md @@ -808,5 +808,5 @@ Helpers Number of connections ```bash -/opt/mtp_proxy/bin/mtp_proxy eval 'lists:sum([proplists:get_value(all_connections, L) || {_, L} <- ranch:info()]).' +/opt/mtp_proxy/bin/mtp_proxy eval 'lists:sum([maps:get(all_connections, L) || {_, L} <- maps:to_list(ranch:info())]).' ``` diff --git a/src/mtp_metric.erl b/src/mtp_metric.erl index 5fec7cb..0ea8aed 100644 --- a/src/mtp_metric.erl +++ b/src/mtp_metric.erl @@ -98,7 +98,7 @@ passive_metrics() -> | [{gauge, [?APP, connections, count], "Count of ranch connections", - [{#{listener => H}, proplists:get_value(all_connections, P)} + [{#{listener => H}, maps:get(all_connections, P)} || {H, P} <- mtproto_proxy_app:mtp_listeners()]}] ]. -spec active_metrics() -> [{metric_type(), metric_name(), metric_doc(), Opts}] diff --git a/src/mtproto_proxy_app.erl b/src/mtproto_proxy_app.erl index 5102838..46b2dea 100644 --- a/src/mtproto_proxy_app.erl +++ b/src/mtproto_proxy_app.erl @@ -92,7 +92,7 @@ diff_env(NewEnv, OldEnv) -> %% @doc List of ranch listeners running mtproto_proxy --spec mtp_listeners() -> [tuple()]. +-spec mtp_listeners() -> [{ranch:ref(), #{atom() => term()}}]. mtp_listeners() -> maps:to_list( maps:filter(