Reorder elements in metric names & improve naming

bytes / packets must come before _total

Explaing element order difference in TOTALS vs the metrics above

[#167846096]
This commit is contained in:
Gerhard Lazu 2019-08-13 19:04:26 +01:00
parent 3d741bb1cd
commit e218ea5ea2
2 changed files with 21 additions and 20 deletions

View File

@ -79,15 +79,15 @@
]},
{connection_coarse_metrics, [
{2, connection_bytes_in_total, counter, "Total number of bytes received on a connection"},
{3, connection_bytes_out_total, counter, "Total number of bytes sent on a connection"},
{2, connection_incoming_bytes_total, counter, "Total number of bytes received on a connection"},
{3, connection_outgoing_bytes_total, counter, "Total number of bytes sent on a connection"},
{4, erlang_process_reductions_total, counter, "Total number of Erlang process reductions"}
]},
{connection_metrics, [
{2, connection_packets_in_total, counter, "Total number of packets received on a connection", recv_cnt},
{2, connection_packets_out_total, counter, "Total number of packets sent on a connection", send_cnt},
{2, connection_packets_pending_total, counter, "Total number of packets waiting to be sent on a connection", send_pend},
{2, connection_incoming_packets_total, counter, "Total number of packets received on a connection", recv_cnt},
{2, connection_outgoing_packets_total, counter, "Total number of packets sent on a connection", send_cnt},
{2, connection_pending_packets, gauge, "Number of packets waiting to be sent on a connection", send_pend},
{2, connection_channels, gauge, "Channels on a connection", channels}
]},
@ -102,7 +102,7 @@
{2, disk_space_available_bytes, gauge, "Disk space available in bytes", disk_free},
{2, erlang_processes_used, gauge, "Erlang processes used", proc_used},
{2, erlang_gc_runs_total, counter, "Total number of Erlang garbage collector runs", gc_num},
{2, erlang_gc_bytes_reclaimed_total, counter, "Total number of bytes of memory reclaimed by Erlang garbage collector", gc_bytes_reclaimed},
{2, erlang_gc_reclaimed_bytes_total, counter, "Total number of bytes of memory reclaimed by Erlang garbage collector", gc_bytes_reclaimed},
{2, erlang_scheduler_context_switches_total, counter, "Total number of Erlang scheduler context switches", context_switches}
]},
@ -175,6 +175,7 @@
]).
-define(TOTALS, [
%% ordering differs from metrics above, refer to list comprehension
{connection_created, connections, gauge, "Connections currently running"},
{channel_created, channels, gauge, "Channels currently running"},
{consumer_created, consumers, gauge, "Consumers currently connected"},

View File

@ -162,20 +162,20 @@ metrics_test(Config) ->
?assertEqual(match, re:run(Body, "TYPE", [{capture, none}])),
?assertEqual(match, re:run(Body, ?config(queue_name, Config), [{capture, none}])),
%% Checking that we have the first metric from each ETS table owned by rabbitmq_metrics
?assertEqual(match, re:run(Body, "rabbitmq_channel_consumers", [{capture, none}])),
?assertEqual(match, re:run(Body, "rabbitmq_channel_messages_published", [{capture, none}])),
?assertEqual(match, re:run(Body, "rabbitmq_erlang_process_reductions", [{capture, none}])),
?assertEqual(match, re:run(Body, "rabbitmq_channel_get_ack", [{capture, none}])),
?assertEqual(match, re:run(Body, "rabbitmq_connection_open", [{capture, none}])),
?assertEqual(match, re:run(Body, "rabbitmq_connection_bytes_in", [{capture, none}])),
?assertEqual(match, re:run(Body, "rabbitmq_connection_packets_in", [{capture, none}])),
?assertEqual(match, re:run(Body, "rabbitmq_queue_messages_published", [{capture, none}])),
?assertEqual(match, re:run(Body, "rabbitmq_file_descriptors_open", [{capture, none}])),
?assertEqual(match, re:run(Body, "rabbitmq_file_descriptors_open_limit", [{capture, none}])),
?assertEqual(match, re:run(Body, "rabbitmq_io_read", [{capture, none}])),
?assertEqual(match, re:run(Body, "rabbitmq_raft_term", [{capture, none}])),
?assertEqual(match, re:run(Body, "rabbitmq_queue_messages_ready", [{capture, none}])),
?assertEqual(match, re:run(Body, "rabbitmq_queue_consumers", [{capture, none}])),
?assertEqual(match, re:run(Body, "rabbitmq_channel_consumers{", [{capture, none}])),
?assertEqual(match, re:run(Body, "rabbitmq_channel_messages_published{", [{capture, none}])),
?assertEqual(match, re:run(Body, "rabbitmq_erlang_process_reductions_total{", [{capture, none}])),
?assertEqual(match, re:run(Body, "rabbitmq_channel_get_ack_total{", [{capture, none}])),
?assertEqual(match, re:run(Body, "rabbitmq_connection_opened_total{", [{capture, none}])),
?assertEqual(match, re:run(Body, "rabbitmq_connection_incoming_bytes_total{", [{capture, none}])),
?assertEqual(match, re:run(Body, "rabbitmq_connection_incoming_packets_total{", [{capture, none}])),
?assertEqual(match, re:run(Body, "rabbitmq_queue_messages_published_total{", [{capture, none}])),
?assertEqual(match, re:run(Body, "rabbitmq_file_descriptors_open{", [{capture, none}])),
?assertEqual(match, re:run(Body, "rabbitmq_file_descriptors_open_limit{", [{capture, none}])),
?assertEqual(match, re:run(Body, "rabbitmq_io_read_ops_total{", [{capture, none}])),
?assertEqual(match, re:run(Body, "rabbitmq_raft_term{", [{capture, none}])),
?assertEqual(match, re:run(Body, "rabbitmq_queue_messages_ready{", [{capture, none}])),
?assertEqual(match, re:run(Body, "rabbitmq_queue_consumers{", [{capture, none}])),
%% Checking the first TOTALS metric
?assertEqual(match, re:run(Body, "rabbitmq_connections", [{capture, none}])).