Skip to content

Commit 908d5b6

Browse files
committed
Adapt metric names to promtool
1 parent b6daa5c commit 908d5b6

File tree

4 files changed

+64
-64
lines changed

4 files changed

+64
-64
lines changed

test/eunit/collectors/mnesia/prometheus_mnesia_collector_tests.erl

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -41,10 +41,10 @@ test_mnesia_on_collector_env_on() ->
4141
?assertMatch(nomatch, re:run(Metrics, "erlang_mnesia_lock_queue")),
4242
?assertMatch(nomatch, re:run(Metrics, "erlang_mnesia_transaction_participants")),
4343
?assertMatch({match, _}, re:run(Metrics, "erlang_mnesia_transaction_coordinators")),
44-
?assertMatch(nomatch, re:run(Metrics, "erlang_mnesia_failed_transactions")),
45-
?assertMatch(nomatch, re:run(Metrics, "erlang_mnesia_committed_transactions")),
46-
?assertMatch(nomatch, re:run(Metrics, "erlang_mnesia_logged_transactions")),
47-
?assertMatch(nomatch, re:run(Metrics, "erlang_mnesia_restarted_transactions")),
44+
?assertMatch(nomatch, re:run(Metrics, "erlang_mnesia_failed_transactions_total")),
45+
?assertMatch(nomatch, re:run(Metrics, "erlang_mnesia_committed_transactions_total")),
46+
?assertMatch(nomatch, re:run(Metrics, "erlang_mnesia_logged_transactions_total")),
47+
?assertMatch(nomatch, re:run(Metrics, "erlang_mnesia_restarted_transactions_total")),
4848
?assertMatch(nomatch, re:run(Metrics, "erlang_mnesia_memory_usage_bytes")),
4949
application:unset_env(prometheus, mnesia_collector_metrics, []).
5050

@@ -56,10 +56,10 @@ test_mnesia_on_collector_env_off() ->
5656
?assertMatch(nomatch, re:run(Metrics, "erlang_mnesia_lock_queue")),
5757
?assertMatch(nomatch, re:run(Metrics, "erlang_mnesia_transaction_participants")),
5858
?assertMatch(nomatch, re:run(Metrics, "erlang_mnesia_transaction_coordinators")),
59-
?assertMatch(nomatch, re:run(Metrics, "erlang_mnesia_failed_transactions")),
60-
?assertMatch(nomatch, re:run(Metrics, "erlang_mnesia_committed_transactions")),
61-
?assertMatch(nomatch, re:run(Metrics, "erlang_mnesia_logged_transactions")),
62-
?assertMatch(nomatch, re:run(Metrics, "erlang_mnesia_restarted_transactions")),
59+
?assertMatch(nomatch, re:run(Metrics, "erlang_mnesia_failed_transactions_total")),
60+
?assertMatch(nomatch, re:run(Metrics, "erlang_mnesia_committed_transactions_total")),
61+
?assertMatch(nomatch, re:run(Metrics, "erlang_mnesia_logged_transactions_total")),
62+
?assertMatch(nomatch, re:run(Metrics, "erlang_mnesia_restarted_transactions_total")),
6363
?assertMatch(nomatch, re:run(Metrics, "erlang_mnesia_memory_usage_bytes")),
6464
application:unset_env(prometheus, mnesia_collector_metrics, []).
6565

@@ -70,10 +70,10 @@ test_mnesia_on_collector() ->
7070
?assertMatch({match, _}, re:run(Metrics, "erlang_mnesia_lock_queue")),
7171
?assertMatch({match, _}, re:run(Metrics, "erlang_mnesia_transaction_participants")),
7272
?assertMatch({match, _}, re:run(Metrics, "erlang_mnesia_transaction_coordinators")),
73-
?assertMatch({match, _}, re:run(Metrics, "erlang_mnesia_failed_transactions")),
74-
?assertMatch({match, _}, re:run(Metrics, "erlang_mnesia_committed_transactions")),
75-
?assertMatch({match, _}, re:run(Metrics, "erlang_mnesia_logged_transactions")),
76-
?assertMatch({match, _}, re:run(Metrics, "erlang_mnesia_restarted_transactions")),
73+
?assertMatch({match, _}, re:run(Metrics, "erlang_mnesia_failed_transactions_total")),
74+
?assertMatch({match, _}, re:run(Metrics, "erlang_mnesia_committed_transactions_total")),
75+
?assertMatch({match, _}, re:run(Metrics, "erlang_mnesia_logged_transactions_total")),
76+
?assertMatch({match, _}, re:run(Metrics, "erlang_mnesia_restarted_transactions_total")),
7777
?assertMatch({match, _}, re:run(Metrics, "erlang_mnesia_memory_usage_bytes")).
7878

7979
test_mnesia_on_collector_global_labels() ->

test/eunit/collectors/vm/prometheus_vm_memory_collector_tests.erl

Lines changed: 18 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -14,33 +14,33 @@ test_default_metrics(_) ->
1414
prometheus_registry:register_collector(prometheus_vm_memory_collector),
1515
Metrics = prometheus_text_format:format(),
1616
[
17-
?_assertMatch({match, _}, re:run(Metrics, "erlang_vm_memory_atom_bytes_total")),
18-
?_assertMatch({match, _}, re:run(Metrics, "erlang_vm_memory_bytes_total")),
17+
?_assertMatch({match, _}, re:run(Metrics, "erlang_vm_memory_atom_bytes")),
18+
?_assertMatch({match, _}, re:run(Metrics, "erlang_vm_memory_bytes")),
1919
?_assertMatch({match, _}, re:run(Metrics, "erlang_vm_memory_dets_tables")),
2020
?_assertMatch({match, _}, re:run(Metrics, "erlang_vm_memory_ets_tables")),
21-
?_assertMatch({match, _}, re:run(Metrics, "erlang_vm_memory_processes_bytes_total")),
22-
?_assertMatch({match, _}, re:run(Metrics, "erlang_vm_memory_system_bytes_total"))
21+
?_assertMatch({match, _}, re:run(Metrics, "erlang_vm_memory_processes_bytes")),
22+
?_assertMatch({match, _}, re:run(Metrics, "erlang_vm_memory_system_bytes"))
2323
].
2424

2525
test_all_metrics(_) ->
2626
try
2727
application:set_env(prometheus, vm_memory_collector_metrics, [
28-
atom_bytes_total,
29-
bytes_total,
28+
atom_bytes,
29+
bytes,
3030
dets_tables,
3131
ets_tables,
32-
processes_bytes_total,
33-
system_bytes_total
32+
processes_bytes,
33+
system_bytes
3434
]),
3535
prometheus_registry:register_collector(prometheus_vm_memory_collector),
3636
Metrics = prometheus_text_format:format(),
3737
[
38-
?_assertMatch({match, _}, re:run(Metrics, "erlang_vm_memory_atom_bytes_total")),
39-
?_assertMatch({match, _}, re:run(Metrics, "erlang_vm_memory_bytes_total")),
38+
?_assertMatch({match, _}, re:run(Metrics, "erlang_vm_memory_atom_bytes")),
39+
?_assertMatch({match, _}, re:run(Metrics, "erlang_vm_memory_bytes")),
4040
?_assertMatch({match, _}, re:run(Metrics, "erlang_vm_memory_dets_tables")),
4141
?_assertMatch({match, _}, re:run(Metrics, "erlang_vm_memory_ets_tables")),
42-
?_assertMatch({match, _}, re:run(Metrics, "erlang_vm_memory_processes_bytes_total")),
43-
?_assertMatch({match, _}, re:run(Metrics, "erlang_vm_memory_system_bytes_total"))
42+
?_assertMatch({match, _}, re:run(Metrics, "erlang_vm_memory_processes_bytes")),
43+
?_assertMatch({match, _}, re:run(Metrics, "erlang_vm_memory_system_bytes"))
4444
]
4545
after
4646
application:unset_env(prometheus, vm_memory_collector_metrics)
@@ -49,18 +49,18 @@ test_all_metrics(_) ->
4949
test_custom_metrics(_) ->
5050
try
5151
application:set_env(prometheus, vm_memory_collector_metrics, [
52-
atom_bytes_total,
52+
atom_bytes,
5353
dets_tables
5454
]),
5555
prometheus_registry:register_collector(prometheus_vm_memory_collector),
5656
Metrics = prometheus_text_format:format(),
5757
[
58-
?_assertMatch({match, _}, re:run(Metrics, "erlang_vm_memory_atom_bytes_total")),
59-
?_assertMatch(nomatch, re:run(Metrics, "erlang_vm_memory_bytes_total")),
58+
?_assertMatch({match, _}, re:run(Metrics, "erlang_vm_memory_atom_bytes")),
59+
?_assertMatch(nomatch, re:run(Metrics, "erlang_vm_memory_bytes")),
6060
?_assertMatch({match, _}, re:run(Metrics, "erlang_vm_memory_dets_tables")),
6161
?_assertMatch(nomatch, re:run(Metrics, "erlang_vm_memory_ets_tables")),
62-
?_assertMatch(nomatch, re:run(Metrics, "erlang_vm_memory_processes_bytes_total")),
63-
?_assertMatch(nomatch, re:run(Metrics, "erlang_vm_memory_system_bytes_total"))
62+
?_assertMatch(nomatch, re:run(Metrics, "erlang_vm_memory_processes_bytes")),
63+
?_assertMatch(nomatch, re:run(Metrics, "erlang_vm_memory_system_bytes"))
6464
]
6565
after
6666
application:unset_env(prometheus, vm_memory_collector_metrics)
@@ -77,5 +77,5 @@ test_global_labels(_) ->
7777
application:unset_env(prometheus, global_labels)
7878
end,
7979
[
80-
?_assertMatch({match, _}, re:run(Metrics, "erlang_vm_memory_atom_bytes_total{node="))
80+
?_assertMatch({match, _}, re:run(Metrics, "erlang_vm_memory_atom_bytes{node="))
8181
].

test/eunit/collectors/vm/prometheus_vm_statistics_collector_tests.erl

Lines changed: 21 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -38,21 +38,21 @@ test_default_metrics(_) ->
3838
{match, _},
3939
re:run(
4040
Metrics,
41-
"erlang_vm_statistics_garbage_collection_number_of_gcs"
41+
"erlang_vm_statistics_garbage_collection_number_of_gcs_total"
4242
)
4343
),
4444
?_assertMatch(
4545
{match, _},
4646
re:run(
4747
Metrics,
48-
"erlang_vm_statistics_garbage_collection_words_reclaimed"
48+
"erlang_vm_statistics_garbage_collection_words_reclaimed_total"
4949
)
5050
),
5151
?_assertMatch(
5252
{match, _},
5353
re:run(
5454
Metrics,
55-
"erlang_vm_statistics_garbage_collection_bytes_reclaimed"
55+
"erlang_vm_statistics_garbage_collection_bytes_reclaimed_total"
5656
)
5757
),
5858
?_assertMatch(
@@ -65,11 +65,11 @@ test_default_metrics(_) ->
6565
),
6666
?_assertMatch(
6767
{match, _},
68-
re:run(Metrics, "erlang_vm_statistics_runtime_milliseconds")
68+
re:run(Metrics, "erlang_vm_statistics_runtime_seconds_total")
6969
),
7070
?_assertMatch(
7171
{match, _},
72-
re:run(Metrics, "erlang_vm_statistics_wallclock_time_milliseconds")
72+
re:run(Metrics, "erlang_vm_statistics_wallclock_time_seconds_total")
7373
)
7474
].
7575

@@ -81,16 +81,16 @@ test_all_metrics(_) ->
8181
[
8282
bytes_output_total,
8383
bytes_received_total,
84-
context_switches,
84+
context_switches_total,
8585
dirty_cpu_run_queue_length,
8686
dirty_io_run_queue_length,
87-
garbage_collection_number_of_gcs,
88-
garbage_collection_bytes_reclaimed,
89-
garbage_collection_words_reclaimed,
87+
garbage_collection_number_of_gcs_total,
88+
garbage_collection_bytes_reclaimed_total,
89+
garbage_collection_words_reclaimed_total,
9090
reductions_total,
9191
run_queues_length,
92-
runtime_milliseconds,
93-
wallclock_time_milliseconds
92+
runtime_seconds_total,
93+
wallclock_time_seconds_total
9494
]
9595
),
9696
prometheus_registry:register_collector(prometheus_vm_statistics_collector),
@@ -120,21 +120,21 @@ test_all_metrics(_) ->
120120
{match, _},
121121
re:run(
122122
Metrics,
123-
"erlang_vm_statistics_garbage_collection_number_of_gcs"
123+
"erlang_vm_statistics_garbage_collection_number_of_gcs_total"
124124
)
125125
),
126126
?_assertMatch(
127127
{match, _},
128128
re:run(
129129
Metrics,
130-
"erlang_vm_statistics_garbage_collection_words_reclaimed"
130+
"erlang_vm_statistics_garbage_collection_words_reclaimed_total"
131131
)
132132
),
133133
?_assertMatch(
134134
{match, _},
135135
re:run(
136136
Metrics,
137-
"erlang_vm_statistics_garbage_collection_bytes_reclaimed"
137+
"erlang_vm_statistics_garbage_collection_bytes_reclaimed_total"
138138
)
139139
),
140140
?_assertMatch(
@@ -147,11 +147,11 @@ test_all_metrics(_) ->
147147
),
148148
?_assertMatch(
149149
{match, _},
150-
re:run(Metrics, "erlang_vm_statistics_runtime_milliseconds")
150+
re:run(Metrics, "erlang_vm_statistics_runtime_seconds_total")
151151
),
152152
?_assertMatch(
153153
{match, _},
154-
re:run(Metrics, "erlang_vm_statistics_wallclock_time_milliseconds")
154+
re:run(Metrics, "erlang_vm_statistics_wallclock_time_seconds_total")
155155
)
156156
]
157157
after
@@ -184,21 +184,21 @@ test_custom_metrics(_) ->
184184
nomatch,
185185
re:run(
186186
Metrics,
187-
"erlang_vm_statistics_garbage_collection_number_of_gcs"
187+
"erlang_vm_statistics_garbage_collection_number_of_gcs_total"
188188
)
189189
),
190190
?_assertMatch(
191191
nomatch,
192192
re:run(
193193
Metrics,
194-
"erlang_vm_statistics_garbage_collection_words_reclaimed"
194+
"erlang_vm_statistics_garbage_collection_words_reclaimed_total"
195195
)
196196
),
197197
?_assertMatch(
198198
nomatch,
199199
re:run(
200200
Metrics,
201-
"erlang_vm_statistics_garbage_collection_bytes_reclaimed"
201+
"erlang_vm_statistics_garbage_collection_bytes_reclaimed_total"
202202
)
203203
),
204204
?_assertMatch(
@@ -211,11 +211,11 @@ test_custom_metrics(_) ->
211211
),
212212
?_assertMatch(
213213
nomatch,
214-
re:run(Metrics, "erlang_vm_statistics_runtime_milliseconds")
214+
re:run(Metrics, "erlang_vm_statistics_runtime_seconds_total")
215215
),
216216
?_assertMatch(
217217
nomatch,
218-
re:run(Metrics, "erlang_vm_statistics_wallclock_time_milliseconds")
218+
re:run(Metrics, "erlang_vm_statistics_wallclock_time_seconds_total")
219219
)
220220
]
221221
after

test/eunit/collectors/vm/prometheus_vm_system_info_collector_tests.erl

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -21,9 +21,9 @@ test_default_metrics(_) ->
2121
?_assertMatch({match, _}, re:run(Metrics, "erlang_vm_logical_processors")),
2222
?_assertMatch({match, _}, re:run(Metrics, "erlang_vm_logical_processors_available")),
2323
?_assertMatch({match, _}, re:run(Metrics, "erlang_vm_logical_processors_online")),
24-
?_assertMatch({match, _}, re:run(Metrics, "erlang_vm_port_count")),
24+
?_assertMatch({match, _}, re:run(Metrics, "erlang_vm_ports")),
2525
?_assertMatch({match, _}, re:run(Metrics, "erlang_vm_port_limit")),
26-
?_assertMatch({match, _}, re:run(Metrics, "erlang_vm_process_count")),
26+
?_assertMatch({match, _}, re:run(Metrics, "erlang_vm_processes")),
2727
?_assertMatch({match, _}, re:run(Metrics, "erlang_vm_process_limit")),
2828
?_assertMatch({match, _}, re:run(Metrics, "erlang_vm_schedulers")),
2929
?_assertMatch({match, _}, re:run(Metrics, "erlang_vm_schedulers_online")),
@@ -32,7 +32,7 @@ test_default_metrics(_) ->
3232
?_assertMatch({match, _}, re:run(Metrics, "erlang_vm_thread_pool_size")),
3333
?_assertMatch({match, _}, re:run(Metrics, "erlang_vm_time_correction")),
3434
?_assertMatch({match, _}, re:run(Metrics, "erlang_vm_wordsize_bytes")),
35-
?_assertMatch({match, _}, re:run(Metrics, "erlang_vm_atom_count")),
35+
?_assertMatch({match, _}, re:run(Metrics, "erlang_vm_atoms")),
3636
?_assertMatch({match, _}, re:run(Metrics, "erlang_vm_atom_limit"))
3737
].
3838

@@ -46,9 +46,9 @@ test_all_metrics(_) ->
4646
logical_processors,
4747
logical_processors_available,
4848
logical_processors_online,
49-
port_count,
49+
ports,
5050
port_limit,
51-
process_count,
51+
processes,
5252
process_limit,
5353
schedulers,
5454
schedulers_online,
@@ -57,7 +57,7 @@ test_all_metrics(_) ->
5757
thread_pool_size,
5858
time_correction,
5959
wordsize_bytes,
60-
atom_count,
60+
atoms,
6161
atom_limit
6262
]
6363
),
@@ -68,9 +68,9 @@ test_all_metrics(_) ->
6868
?_assertMatch({match, _}, re:run(Metrics, "erlang_vm_logical_processors")),
6969
?_assertMatch({match, _}, re:run(Metrics, "erlang_vm_logical_processors_available")),
7070
?_assertMatch({match, _}, re:run(Metrics, "erlang_vm_logical_processors_online")),
71-
?_assertMatch({match, _}, re:run(Metrics, "erlang_vm_port_count")),
71+
?_assertMatch({match, _}, re:run(Metrics, "erlang_vm_ports")),
7272
?_assertMatch({match, _}, re:run(Metrics, "erlang_vm_port_limit")),
73-
?_assertMatch({match, _}, re:run(Metrics, "erlang_vm_process_count")),
73+
?_assertMatch({match, _}, re:run(Metrics, "erlang_vm_processes")),
7474
?_assertMatch({match, _}, re:run(Metrics, "erlang_vm_process_limit")),
7575
?_assertMatch({match, _}, re:run(Metrics, "erlang_vm_schedulers")),
7676
?_assertMatch({match, _}, re:run(Metrics, "erlang_vm_schedulers_online")),
@@ -79,7 +79,7 @@ test_all_metrics(_) ->
7979
?_assertMatch({match, _}, re:run(Metrics, "erlang_vm_thread_pool_size")),
8080
?_assertMatch({match, _}, re:run(Metrics, "erlang_vm_time_correction")),
8181
?_assertMatch({match, _}, re:run(Metrics, "erlang_vm_wordsize_bytes")),
82-
?_assertMatch({match, _}, re:run(Metrics, "erlang_vm_atom_count")),
82+
?_assertMatch({match, _}, re:run(Metrics, "erlang_vm_atoms")),
8383
?_assertMatch({match, _}, re:run(Metrics, "erlang_vm_atom_limit"))
8484
]
8585
after
@@ -94,8 +94,8 @@ test_custom_metrics(_) ->
9494
[
9595
ets_limit,
9696
logical_processors,
97-
port_count,
98-
process_count,
97+
ports,
98+
processes,
9999
process_limit,
100100
schedulers
101101
]
@@ -107,9 +107,9 @@ test_custom_metrics(_) ->
107107
?_assertMatch({match, _}, re:run(Metrics, "erlang_vm_logical_processors")),
108108
?_assertMatch(nomatch, re:run(Metrics, "erlang_vm_logical_processors_available")),
109109
?_assertMatch(nomatch, re:run(Metrics, "erlang_vm_logical_processors_online")),
110-
?_assertMatch({match, _}, re:run(Metrics, "erlang_vm_port_count")),
110+
?_assertMatch({match, _}, re:run(Metrics, "erlang_vm_ports")),
111111
?_assertMatch(nomatch, re:run(Metrics, "erlang_vm_port_limit")),
112-
?_assertMatch({match, _}, re:run(Metrics, "erlang_vm_process_count")),
112+
?_assertMatch({match, _}, re:run(Metrics, "erlang_vm_processes")),
113113
?_assertMatch({match, _}, re:run(Metrics, "erlang_vm_process_limit")),
114114
?_assertMatch({match, _}, re:run(Metrics, "erlang_vm_schedulers")),
115115
?_assertMatch(nomatch, re:run(Metrics, "erlang_vm_schedulers_online")),

0 commit comments

Comments
 (0)