Skip to content

Commit 6ff7108

Browse files
committed
Use maps for global metric labels
1 parent 0965d5e commit 6ff7108

File tree

5 files changed

+19
-19
lines changed

5 files changed

+19
-19
lines changed

deps/rabbit/test/amqp_client_SUITE.erl

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6911,11 +6911,11 @@ formatted_state(Pid) ->
69116911
proplists:get_value("State", L2).
69126912

69136913
get_global_counters(Config) ->
6914-
get_global_counters0(Config, [{protocol, amqp10}]).
6914+
get_global_counters0(Config, #{protocol => amqp10}).
69156915

69166916
get_global_counters(Config, QType) ->
6917-
get_global_counters0(Config, [{protocol, amqp10},
6918-
{queue_type, QType}]).
6917+
get_global_counters0(Config, #{protocol => amqp10,
6918+
queue_type => QType}).
69196919

69206920
get_global_counters0(Config, Key) ->
69216921
Overview = rpc(Config, rabbit_global_counters, overview, []),

deps/rabbit/test/queue_type_SUITE.erl

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -162,7 +162,7 @@ smoke(Config) ->
162162
ok = publish_and_confirm(Ch, <<"non-existent_queue">>, <<"msg4">>),
163163
ConsumerTag3 = <<"ctag3">>,
164164
ok = subscribe(Ch, QName, ConsumerTag3),
165-
ProtocolCounters = maps:get([{protocol, amqp091}], get_global_counters(Config)),
165+
ProtocolCounters = maps:get(#{protocol => amqp091}, get_global_counters(Config)),
166166
?assertEqual(#{
167167
messages_confirmed_total => 4,
168168
messages_received_confirm_total => 4,
@@ -177,7 +177,7 @@ smoke(Config) ->
177177
"rabbit_" ++
178178
binary_to_list(?config(queue_type, Config)) ++
179179
"_queue"),
180-
ProtocolQueueTypeCounters = maps:get([{protocol, amqp091}, {queue_type, QueueType}],
180+
ProtocolQueueTypeCounters = maps:get(#{protocol => amqp091, queue_type => QueueType},
181181
get_global_counters(Config)),
182182
?assertEqual(#{
183183
messages_acknowledged_total => 3,
@@ -196,7 +196,7 @@ smoke(Config) ->
196196
?assertMatch(
197197
#{consumers := 0,
198198
publishers := 0},
199-
maps:get([{protocol, amqp091}], get_global_counters(Config))),
199+
maps:get(#{protocol => amqp091}, get_global_counters(Config))),
200200

201201
ok.
202202

deps/rabbitmq_mqtt/test/mqtt_shared_SUITE.erl

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -696,7 +696,7 @@ global_counters(Config) ->
696696
messages_delivered_get_manual_ack_total => 0,
697697
messages_get_empty_total => 0,
698698
messages_redelivered_total => 0},
699-
get_global_counters(Config, ProtoVer, 0, [{queue_type, rabbit_classic_queue}])),
699+
get_global_counters(Config, ProtoVer, 0, #{queue_type => rabbit_classic_queue})),
700700
?assertEqual(#{messages_delivered_total => 1,
701701
messages_acknowledged_total => 0,
702702
messages_delivered_consume_auto_ack_total => 1,
@@ -705,7 +705,7 @@ global_counters(Config) ->
705705
messages_delivered_get_manual_ack_total => 0,
706706
messages_get_empty_total => 0,
707707
messages_redelivered_total => 0},
708-
get_global_counters(Config, ProtoVer, 0, [{queue_type, rabbit_mqtt_qos0_queue}])),
708+
get_global_counters(Config, ProtoVer, 0, #{queue_type => rabbit_mqtt_qos0_queue})),
709709

710710
{ok, _, _} = emqtt:unsubscribe(C, Topic1),
711711
?assertEqual(1, maps:get(consumers, get_global_counters(Config, ProtoVer))),

deps/rabbitmq_mqtt/test/util.erl

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -76,16 +76,16 @@ get_global_counters(Config, ProtoVer) ->
7676
get_global_counters(Config, ProtoVer, 0).
7777

7878
get_global_counters(Config, ProtoVer, Node) ->
79-
get_global_counters(Config, ProtoVer, Node, []).
80-
81-
get_global_counters(Config, v3, Node, QType) ->
82-
get_global_counters(Config, ?MQTT_PROTO_V3, Node, QType);
83-
get_global_counters(Config, v4, Node, QType) ->
84-
get_global_counters(Config, ?MQTT_PROTO_V4, Node, QType);
85-
get_global_counters(Config, v5, Node, QType) ->
86-
get_global_counters(Config, ?MQTT_PROTO_V5, Node, QType);
87-
get_global_counters(Config, Proto, Node, QType) ->
88-
maps:get([{protocol, Proto}] ++ QType,
79+
get_global_counters(Config, ProtoVer, Node, #{}).
80+
81+
get_global_counters(Config, v3, Node, Labels) ->
82+
get_global_counters(Config, ?MQTT_PROTO_V3, Node, Labels);
83+
get_global_counters(Config, v4, Node, Labels) ->
84+
get_global_counters(Config, ?MQTT_PROTO_V4, Node, Labels);
85+
get_global_counters(Config, v5, Node, Labels) ->
86+
get_global_counters(Config, ?MQTT_PROTO_V5, Node, Labels);
87+
get_global_counters(Config, Proto, Node, Labels) ->
88+
maps:get(Labels#{protocol => Proto},
8989
rabbit_ct_broker_helpers:rpc(Config, Node, rabbit_global_counters, overview, [])).
9090

9191
get_events(Node) ->

deps/rabbitmq_prometheus/src/collectors/prometheus_rabbitmq_raft_metrics_collector.erl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ collect_mf(_Registry, Callback) ->
3535
create_mf(?METRIC_NAME(Name),
3636
Help,
3737
Type,
38-
maps:to_list(Values)))
38+
Values))
3939
end,
4040
seshat:format(ra, [term,
4141
snapshot_index,

0 commit comments

Comments
 (0)