Skip to content

Commit 37b85cb

Browse files
committed
Use maps for global metric labels
1 parent e8d5d83 commit 37b85cb

File tree

10 files changed

+27
-27
lines changed

10 files changed

+27
-27
lines changed

deps/rabbit/test/amqp_client_SUITE.erl

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

69696969
get_global_counters(Config) ->
6970-
get_global_counters0(Config, [{protocol, amqp10}]).
6970+
get_global_counters0(Config, #{protocol => amqp10}).
69716971

69726972
get_global_counters(Config, QType) ->
6973-
get_global_counters0(Config, [{protocol, amqp10},
6974-
{queue_type, QType}]).
6973+
get_global_counters0(Config, #{protocol => amqp10,
6974+
queue_type => QType}).
69756975

69766976
get_global_counters0(Config, Key) ->
69776977
Overview = rpc(Config, rabbit_global_counters, overview, []),

deps/rabbit/test/dead_lettering_SUITE.erl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1936,7 +1936,7 @@ counted(Metric, Config) ->
19361936
metric(QueueType, Strategy, Metric, OldCounters).
19371937

19381938
metric(QueueType, Strategy, Metric, Counters) ->
1939-
Metrics = maps:get([{queue_type, QueueType}, {dead_letter_strategy, Strategy}], Counters),
1939+
Metrics = maps:get(#{queue_type => QueueType, dead_letter_strategy => Strategy}, Counters),
19401940
maps:get(Metric, Metrics).
19411941

19421942
group_name(Config) ->

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/rabbit/test/rabbit_fifo_dlx_integration_SUITE.erl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -991,5 +991,5 @@ counted(Metric, Config) ->
991991
metric(Metric, OldCounters).
992992

993993
metric(Metric, Counters) ->
994-
Metrics = maps:get([{queue_type, rabbit_quorum_queue}, {dead_letter_strategy, at_least_once}], Counters),
994+
Metrics = maps:get(#{queue_type => rabbit_quorum_queue, dead_letter_strategy => at_least_once}, Counters),
995995
maps:get(Metric, Metrics).

deps/rabbitmq_mqtt/test/mqtt_shared_SUITE.erl

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -715,7 +715,7 @@ global_counters(Config) ->
715715
messages_delivered_get_manual_ack_total => 0,
716716
messages_get_empty_total => 0,
717717
messages_redelivered_total => 0},
718-
get_global_counters(Config, ProtoVer, 0, [{queue_type, rabbit_classic_queue}])),
718+
get_global_counters(Config, ProtoVer, 0, #{queue_type => rabbit_classic_queue})),
719719
?assertEqual(#{messages_delivered_total => 1,
720720
messages_acknowledged_total => 0,
721721
messages_delivered_consume_auto_ack_total => 1,
@@ -724,7 +724,7 @@ global_counters(Config) ->
724724
messages_delivered_get_manual_ack_total => 0,
725725
messages_get_empty_total => 0,
726726
messages_redelivered_total => 0},
727-
get_global_counters(Config, ProtoVer, 0, [{queue_type, rabbit_mqtt_qos0_queue}])),
727+
get_global_counters(Config, ProtoVer, 0, #{queue_type => rabbit_mqtt_qos0_queue})),
728728

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

deps/rabbitmq_mqtt/test/reader_SUITE.erl

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -261,11 +261,11 @@ rabbit_mqtt_qos0_queue_overflow(Config) ->
261261
QType = rabbit_mqtt_qos0_queue,
262262

263263
#{
264-
[{protocol, ProtoVer}, {queue_type, QType}] :=
264+
#{protocol => ProtoVer, queue_type => QType} :=
265265
#{messages_delivered_total := 0,
266266
messages_delivered_consume_auto_ack_total := 0},
267267

268-
[{queue_type, QType}, {dead_letter_strategy, disabled}] :=
268+
#{queue_type => QType, dead_letter_strategy => disabled} :=
269269
#{messages_dead_lettered_maxlen_total := NumDeadLettered}
270270
} = rabbit_ct_broker_helpers:rpc(Config, rabbit_global_counters, overview, []),
271271

@@ -320,11 +320,11 @@ rabbit_mqtt_qos0_queue_overflow(Config) ->
320320
ExpectedNumDeadLettered = NumDeadLettered + NumDropped,
321321
?assertMatch(
322322
#{
323-
[{protocol, ProtoVer}, {queue_type, QType}] :=
323+
#{protocol => ProtoVer, queue_type => QType} :=
324324
#{messages_delivered_total := NumReceived,
325325
messages_delivered_consume_auto_ack_total := NumReceived},
326326

327-
[{queue_type, QType}, {dead_letter_strategy, disabled}] :=
327+
#{queue_type => QType, dead_letter_strategy => disabled} :=
328328
#{messages_dead_lettered_maxlen_total := ExpectedNumDeadLettered}
329329
},
330330
rabbit_ct_broker_helpers:rpc(Config, rabbit_global_counters, overview, [])),

deps/rabbitmq_mqtt/test/util.erl

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

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

9292
get_events(Node) ->

deps/rabbitmq_mqtt/test/v5_SUITE.erl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2196,7 +2196,7 @@ dead_letter_metric(Metric, Config) ->
21962196

21972197
dead_letter_metric(Metric, Config, Strategy) ->
21982198
Counters = rpc(Config, rabbit_global_counters, overview, []),
2199-
Map = maps:get([{queue_type, rabbit_classic_queue}, {dead_letter_strategy, Strategy}], Counters),
2199+
Map = maps:get(#{queue_type => rabbit_classic_queue, dead_letter_strategy => Strategy}, Counters),
22002200
maps:get(Metric, Map).
22012201

22022202
assert_nothing_received() ->

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,

deps/rabbitmq_stream/test/rabbit_stream_SUITE.erl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1619,7 +1619,7 @@ get_osiris_counters(Config) ->
16191619
[]).
16201620

16211621
get_global_counters(Config) ->
1622-
maps:get([{protocol, stream}],
1622+
maps:get(#{protocol => stream},
16231623
rabbit_ct_broker_helpers:rpc(Config,
16241624
0,
16251625
rabbit_global_counters,

0 commit comments

Comments
 (0)