Use more reliable method of filtering ranch listeners

parent ea6c692a
...@@ -66,12 +66,11 @@ notify(Type, Name, Value, Extra) -> ...@@ -66,12 +66,11 @@ notify(Type, Name, Value, Extra) ->
Labels :: #{atom() => binary() | atom()}, Labels :: #{atom() => binary() | atom()},
Value :: integer() | float(). Value :: integer() | float().
passive_metrics() -> passive_metrics() ->
AppListeners = [Name || #{name := Name} <- application:get_env(?APP, ports, [])],
[{gauge, [?APP, connections, count], [{gauge, [?APP, connections, count],
"Count of ranch connections", "Count of ranch connections",
[{#{listener => H}, proplists:get_value(all_connections, P)} [{#{listener => H}, proplists:get_value(all_connections, P)}
|| {H, P} <- ranch:info(), || {H, P} <- ranch:info(),
lists:member(H, AppListeners)]}]. proplists:get_value(protocol, P) == mtp_handler]}].
-spec active_metrics() -> [{metric_type(), metric_name(), metric_doc(), Opts}] -spec active_metrics() -> [{metric_type(), metric_name(), metric_doc(), Opts}]
when when
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment