Skip to content

Commit 51402be

Browse files
Prometheus: exclude tags from virtual host labels
1 parent 568dd75 commit 51402be

File tree

2 files changed

+5
-16
lines changed

2 files changed

+5
-16
lines changed

deps/rabbitmq_prometheus/src/collectors/prometheus_rabbitmq_core_metrics_collector.erl

+4-15
Original file line numberDiff line numberDiff line change
@@ -752,19 +752,8 @@ vhost_labels(VHost) ->
752752
undefined -> M0;
753753
V1 -> maps:put(<<"description">>, V1, M0)
754754
end,
755-
M2 = case vhost:get_tags(VHost) of
756-
[] -> M1;
757-
V2 ->
758-
Bin = join_bins(<<",">>, [rabbit_data_coercion:to_binary(T) || T <- V2]),
759-
maps:put(<<"tags">>, Bin, M1)
755+
M2 = case vhost:get_default_queue_type(VHost) of
756+
undefined -> M1;
757+
V2 -> maps:put(<<"default_queue_type">>, V2, M1)
760758
end,
761-
M3 = case vhost:get_default_queue_type(VHost) of
762-
undefined -> M2;
763-
V3 -> maps:put(<<"default_queue_type">>, V3, M2)
764-
end,
765-
M3.
766-
767-
-spec join_bins(Separator :: binary(), List :: [binary()]) -> binary().
768-
join_bins(_, []) -> <<>>;
769-
join_bins(Separator, [H | Tail]) ->
770-
lists:foldl(fun(V, Acc) -> <<Acc/binary, Separator/binary, V/binary>> end, H, Tail).
759+
M2.

deps/rabbitmq_prometheus/test/rabbit_prometheus_http_SUITE.erl

+1-1
Original file line numberDiff line numberDiff line change
@@ -110,7 +110,7 @@ init_per_group(detailed_metrics, Config0) ->
110110
VHost1Conn = rabbit_ct_client_helpers:open_unmanaged_connection(Config1, 0, <<"vhost-1">>),
111111
{ok, VHost1Ch} = amqp_connection:open_channel(VHost1Conn),
112112

113-
rabbit_ct_broker_helpers:add_vhost_with_metadata(Config1, 0, <<"vhost-2">>, <<"description 2">>, [<<"tag1">>, <<"tag2">>]),
113+
rabbit_ct_broker_helpers:add_vhost_with_metadata(Config1, 0, <<"vhost-2">>, <<"description 2">>, []),
114114
rabbit_ct_broker_helpers:set_full_permissions(Config1, <<"vhost-2">>),
115115
VHost2Conn = rabbit_ct_client_helpers:open_unmanaged_connection(Config1, 0, <<"vhost-2">>),
116116
{ok, VHost2Ch} = amqp_connection:open_channel(VHost2Conn),

0 commit comments

Comments
 (0)