diff --git a/rebar.config b/rebar.config index 473edcf3..ce38c206 100644 --- a/rebar.config +++ b/rebar.config @@ -74,11 +74,11 @@ ]}. {project_plugins, [ - {rebar3_hex, "~> 7.0.8"}, - {rebar3_lint, "~> 3.2.6"}, - {rebar3_ex_doc, "~> 0.2.25"}, - {erlfmt, "~> 1.6.0"}, - {covertool, "~> 2.0.7"} + {rebar3_hex, "~> 7.0"}, + {rebar3_lint, "~> 4.1"}, + {rebar3_ex_doc, "~> 0.2"}, + {erlfmt, "~> 1.7"}, + {covertool, "~> 2.0"} ]}. {hex, [{doc, #{provider => ex_doc}}]}. diff --git a/src/collectors/vm/prometheus_vm_system_info_collector.erl b/src/collectors/vm/prometheus_vm_system_info_collector.erl index a6576e9e..1cc962bc 100644 --- a/src/collectors/vm/prometheus_vm_system_info_collector.erl +++ b/src/collectors/vm/prometheus_vm_system_info_collector.erl @@ -222,12 +222,12 @@ metric_enabled(Name, Metrics) -> collect_allocator_metrics() -> Metrics = lists:flatten([ - collect_allocator_metrics_(Alloc, Instance, Info) + collect_allocator_metrics_1(Alloc, Instance, Info) || {{Alloc, Instance}, Info} <- allocators() ]), prometheus_model_helpers:gauge_metrics(Metrics). -collect_allocator_metrics_(Alloc, Instance, Info) -> +collect_allocator_metrics_1(Alloc, Instance, Info) -> [ [ allocator_metric(Alloc, Instance, Kind, Key, KindInfo) @@ -248,17 +248,21 @@ allocator_metric(Alloc, Instance, Kind, Key, Values) -> }. %% Originally copied from recon_alloc. +%% versions is deleted because never really having come across a case where it was useful to know. allocators() -> Allocators = erlang:system_info(alloc_util_allocators), - %% versions is deleted in order to allow the use of the orddict api, - %% and never really having come across a case where it was useful to know. - [ - {{A, N}, lists:sort(proplists:delete(versions, Props))} - || A <- Allocators, - Allocs <- [erlang:system_info({allocator, A})], - Allocs =/= false, - {_, N, Props} <- Allocs - ]. + lists:flatmap(fun allocator/1, Allocators). + +allocator(A) -> + case erlang:system_info({allocator, A}) of + false -> + []; + Allocs -> + [ + {{A, N}, lists:sort(proplists:delete(versions, Props))} + || {_, N, Props} <- Allocs + ] + end. allocator_blocks_metric(Alloc, Instance, Kind, count, KindInfo) -> Count = diff --git a/src/metrics/prometheus_boolean.erl b/src/metrics/prometheus_boolean.erl index 68e6285a..7c220238 100644 --- a/src/metrics/prometheus_boolean.erl +++ b/src/metrics/prometheus_boolean.erl @@ -173,7 +173,7 @@ Raises: Value :: prometheus:prometheus_boolean(). set(Registry, Name, LabelValues, Value) -> Value1 = prometheus_model_helpers:boolean_value(Value), - set_(Registry, Name, LabelValues, Value1). + set_1(Registry, Name, LabelValues, Value1). ?DOC(#{equiv => toggle(default, Name, [])}). -spec toggle(prometheus_metric:name()) -> ok. @@ -348,12 +348,12 @@ collect_metrics(Name, {CLabels, Labels, Registry}) -> deregister_select(Registry, Name) -> [{{{Registry, Name, '_'}, '_'}, [], [true]}]. -set_(Registry, Name, LabelValues, Value) -> +set_1(Registry, Name, LabelValues, Value) -> Key = {Registry, Name, LabelValues}, Spec = {?BOOLEAN_POS, Value}, case ets:update_element(?TABLE, Key, Spec) of false -> - insert_metric(Registry, Name, LabelValues, Value, fun set_/4); + insert_metric(Registry, Name, LabelValues, Value, fun set_1/4); true -> ok end. diff --git a/test/eunit/metric/prometheus_quantile_summary_tests.erl b/test/eunit/metric/prometheus_quantile_summary_tests.erl index b6ee35cc..4668c0ae 100644 --- a/test/eunit/metric/prometheus_quantile_summary_tests.erl +++ b/test/eunit/metric/prometheus_quantile_summary_tests.erl @@ -478,4 +478,6 @@ collect_monitors([{Pid, Ref} | Monitors]) -> {'DOWN', Ref, process, Pid, Reason} -> ?assertEqual(normal, Reason), collect_monitors(Monitors) + after 5000 -> + ct:fail("Tasks never finished in a reasonable amount of time") end.