Skip to content

Commit cf4f484

Browse files
authored
Fix capturing new metric names (#191)
1 parent a537ab4 commit cf4f484

File tree

2 files changed

+28
-22
lines changed

2 files changed

+28
-22
lines changed

src/collectors/vm/prometheus_vm_system_info_collector.erl

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ Collects Erlang VM metrics using `erlang:system_info/1`.
3939
* `erlang_vm_port_limit`
4040
Type: gauge.
4141
The maximum number of simultaneously existing ports at the local node.
42-
* `erlang_vm_process_count`
42+
* `erlang_vm_processes`
4343
Type: gauge.
4444
The number of processes currently existing at the local node.
4545
* `erlang_vm_process_limit`
@@ -90,7 +90,7 @@ Options are the same as Item parameter values for `erlang:system_info/1`:
9090
* `logical_processors_online` for `erlang_vm_logical_processors_online`.
9191
* `ports` for `erlang_vm_ports`.
9292
* `port_limit` for `erlang_vm_port_limit`.
93-
* `process_count` for `erlang_vm_process_count`.
93+
* `processes` for `erlang_vm_processes`.
9494
* `process_limit` for `erlang_vm_process_limit`.
9595
* `schedulers` for `erlang_vm_schedulers`.
9696
* `schedulers_online` for `erlang_vm_schedulers_online`.
@@ -204,6 +204,12 @@ collect_metrics(allocators) ->
204204
collect_allocator_metrics();
205205
collect_metrics(wordsize_bytes) ->
206206
erlang:system_info(wordsize);
207+
collect_metrics(atoms) ->
208+
erlang:system_info(atom_count);
209+
collect_metrics(ports) ->
210+
erlang:system_info(port_count);
211+
collect_metrics(processes) ->
212+
erlang:system_info(process_count);
207213
collect_metrics(Name) ->
208214
try
209215
case erlang:system_info(Name) of

test/eunit/collectors/vm/prometheus_vm_system_info_collector_tests.erl

Lines changed: 20 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -14,26 +14,26 @@ test_default_metrics(_) ->
1414
prometheus_registry:register_collector(prometheus_vm_system_info_collector),
1515
Metrics = prometheus_text_format:format(),
1616
[
17-
?_assertMatch({match, _}, re:run(Metrics, "erlang_vm_dirty_cpu_schedulers")),
18-
?_assertMatch({match, _}, re:run(Metrics, "erlang_vm_dirty_cpu_schedulers_online")),
19-
?_assertMatch({match, _}, re:run(Metrics, "erlang_vm_dirty_io_schedulers")),
20-
?_assertMatch({match, _}, re:run(Metrics, "erlang_vm_ets_limit")),
21-
?_assertMatch({match, _}, re:run(Metrics, "erlang_vm_logical_processors")),
22-
?_assertMatch({match, _}, re:run(Metrics, "erlang_vm_logical_processors_available")),
23-
?_assertMatch({match, _}, re:run(Metrics, "erlang_vm_logical_processors_online")),
24-
?_assertMatch({match, _}, re:run(Metrics, "erlang_vm_ports")),
25-
?_assertMatch({match, _}, re:run(Metrics, "erlang_vm_port_limit")),
26-
?_assertMatch({match, _}, re:run(Metrics, "erlang_vm_processes")),
27-
?_assertMatch({match, _}, re:run(Metrics, "erlang_vm_process_limit")),
28-
?_assertMatch({match, _}, re:run(Metrics, "erlang_vm_schedulers")),
29-
?_assertMatch({match, _}, re:run(Metrics, "erlang_vm_schedulers_online")),
30-
?_assertMatch({match, _}, re:run(Metrics, "erlang_vm_smp_support")),
31-
?_assertMatch({match, _}, re:run(Metrics, "erlang_vm_threads")),
32-
?_assertMatch({match, _}, re:run(Metrics, "erlang_vm_thread_pool_size")),
33-
?_assertMatch({match, _}, re:run(Metrics, "erlang_vm_time_correction")),
34-
?_assertMatch({match, _}, re:run(Metrics, "erlang_vm_wordsize_bytes")),
35-
?_assertMatch({match, _}, re:run(Metrics, "erlang_vm_atoms")),
36-
?_assertMatch({match, _}, re:run(Metrics, "erlang_vm_atom_limit"))
17+
?_assertMatch({match, _}, re:run(Metrics, "\nerlang_vm_dirty_cpu_schedulers")),
18+
?_assertMatch({match, _}, re:run(Metrics, "\nerlang_vm_dirty_cpu_schedulers_online")),
19+
?_assertMatch({match, _}, re:run(Metrics, "\nerlang_vm_dirty_io_schedulers")),
20+
?_assertMatch({match, _}, re:run(Metrics, "\nerlang_vm_ets_limit")),
21+
?_assertMatch({match, _}, re:run(Metrics, "\nerlang_vm_logical_processors")),
22+
?_assertMatch({match, _}, re:run(Metrics, "\nerlang_vm_logical_processors_available")),
23+
?_assertMatch({match, _}, re:run(Metrics, "\nerlang_vm_logical_processors_online")),
24+
?_assertMatch({match, _}, re:run(Metrics, "\nerlang_vm_ports")),
25+
?_assertMatch({match, _}, re:run(Metrics, "\nerlang_vm_port_limit")),
26+
?_assertMatch({match, _}, re:run(Metrics, "\nerlang_vm_processes")),
27+
?_assertMatch({match, _}, re:run(Metrics, "\nerlang_vm_process_limit")),
28+
?_assertMatch({match, _}, re:run(Metrics, "\nerlang_vm_schedulers")),
29+
?_assertMatch({match, _}, re:run(Metrics, "\nerlang_vm_schedulers_online")),
30+
?_assertMatch({match, _}, re:run(Metrics, "\nerlang_vm_smp_support")),
31+
?_assertMatch({match, _}, re:run(Metrics, "\nerlang_vm_threads")),
32+
?_assertMatch({match, _}, re:run(Metrics, "\nerlang_vm_thread_pool_size")),
33+
?_assertMatch({match, _}, re:run(Metrics, "\nerlang_vm_time_correction")),
34+
?_assertMatch({match, _}, re:run(Metrics, "\nerlang_vm_wordsize_bytes")),
35+
?_assertMatch({match, _}, re:run(Metrics, "\nerlang_vm_atoms")),
36+
?_assertMatch({match, _}, re:run(Metrics, "\nerlang_vm_atom_limit"))
3737
].
3838

3939
test_all_metrics(_) ->

0 commit comments

Comments
 (0)