Skip to content

Commit fd2a750

Browse files
committed
Add erlang_vm_wordsize to system_info collector
1 parent 7253b24 commit fd2a750

File tree

2 files changed

+17
-1
lines changed

2 files changed

+17
-1
lines changed

src/collectors/vm/prometheus_vm_system_info_collector.erl

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -95,6 +95,11 @@
9595
%% 1 if time correction is enabled, otherwise 0.
9696
%% </li>
9797
%% <li>
98+
%% `erlang_vm_wordsize_bytes'<br/>
99+
%% Type: gauge.<br/>
100+
%% The size of Erlang term words in bytes.
101+
%% </li>
102+
%% <li>
98103
%% `erlang_vm_atom_count'<br/>
99104
%% Type: gauge.<br/>
100105
%% The number of atom currently existing at the local node.
@@ -166,6 +171,9 @@
166171
%% `time_correction' for `erlang_vm_time_correction'.
167172
%% </li>
168173
%% <li>
174+
%% `wordsize_bytes' for `erlang_vm_wordsize_bytes'.
175+
%% </li>
176+
%% <li>
169177
%% `atom_count' for `erlang_vm_atom_count'.
170178
%% </li>
171179
%% <li>
@@ -268,6 +276,8 @@ metrics() ->
268276
"used for asynchronous driver calls."},
269277
{time_correction, boolean,
270278
"1 if time correction is enabled, otherwise 0."},
279+
{wordsize_bytes, gauge,
280+
"The size of Erlang term words in bytes."},
271281
{atom_count, gauge,
272282
"The number of atom currently existing "
273283
"at the local node."},
@@ -282,6 +292,8 @@ metrics() ->
282292

283293
collect_metrics(allocators) ->
284294
collect_allocator_metrics();
295+
collect_metrics(wordsize_bytes) ->
296+
erlang:system_info(wordsize);
285297
collect_metrics(Name) ->
286298
try
287299
case erlang:system_info(Name) of

test/eunit/collectors/vm/prometheus_vm_system_info_collector_tests.erl

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,7 @@ test_default_metrics(_) ->
3232
?_assertMatch({match, _}, re:run(Metrics, "erlang_vm_threads")),
3333
?_assertMatch({match, _}, re:run(Metrics, "erlang_vm_thread_pool_size")),
3434
?_assertMatch({match, _}, re:run(Metrics, "erlang_vm_time_correction")),
35+
?_assertMatch({match, _}, re:run(Metrics, "erlang_vm_wordsize_bytes")),
3536
?_assertMatch({match, _}, re:run(Metrics, "erlang_vm_atom_count")),
3637
?_assertMatch({match, _}, re:run(Metrics, "erlang_vm_atom_limit"))
3738
].
@@ -55,6 +56,7 @@ test_all_metrics(_) ->
5556
threads,
5657
thread_pool_size,
5758
time_correction,
59+
wordsize_bytes,
5860
atom_count,
5961
atom_limit
6062
]),
@@ -75,6 +77,7 @@ test_all_metrics(_) ->
7577
?_assertMatch({match, _}, re:run(Metrics, "erlang_vm_threads")),
7678
?_assertMatch({match, _}, re:run(Metrics, "erlang_vm_thread_pool_size")),
7779
?_assertMatch({match, _}, re:run(Metrics, "erlang_vm_time_correction")),
80+
?_assertMatch({match, _}, re:run(Metrics, "erlang_vm_wordsize_bytes")),
7881
?_assertMatch({match, _}, re:run(Metrics, "erlang_vm_atom_count")),
7982
?_assertMatch({match, _}, re:run(Metrics, "erlang_vm_atom_limit"))
8083
]
@@ -111,7 +114,8 @@ test_custom_metrics(_) ->
111114
?_assertMatch(nomatch, re:run(Metrics, "erlang_vm_smp_support")),
112115
?_assertMatch(nomatch, re:run(Metrics, "erlang_vm_threads")),
113116
?_assertMatch(nomatch, re:run(Metrics, "erlang_vm_thread_pool_size")),
114-
?_assertMatch(nomatch, re:run(Metrics, "erlang_vm_time_correction"))
117+
?_assertMatch(nomatch, re:run(Metrics, "erlang_vm_time_correction")),
118+
?_assertMatch(nomatch, re:run(Metrics, "erlang_vm_wordsize_bytes"))
115119
]
116120

117121
after

0 commit comments

Comments
 (0)