Skip to content

Commit

Permalink
Prometheus: exclude tags from virtual host labels
Browse files Browse the repository at this point in the history
  • Loading branch information
michaelklishin committed Mar 27, 2024
1 parent 568dd75 commit 51402be
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 16 deletions.
Expand Up @@ -752,19 +752,8 @@ vhost_labels(VHost) ->
undefined -> M0;
V1 -> maps:put(<<"description">>, V1, M0)
end,
M2 = case vhost:get_tags(VHost) of
[] -> M1;
V2 ->
Bin = join_bins(<<",">>, [rabbit_data_coercion:to_binary(T) || T <- V2]),
maps:put(<<"tags">>, Bin, M1)
M2 = case vhost:get_default_queue_type(VHost) of
undefined -> M1;
V2 -> maps:put(<<"default_queue_type">>, V2, M1)
end,
M3 = case vhost:get_default_queue_type(VHost) of
undefined -> M2;
V3 -> maps:put(<<"default_queue_type">>, V3, M2)
end,
M3.

-spec join_bins(Separator :: binary(), List :: [binary()]) -> binary().
join_bins(_, []) -> <<>>;
join_bins(Separator, [H | Tail]) ->
lists:foldl(fun(V, Acc) -> <<Acc/binary, Separator/binary, V/binary>> end, H, Tail).
M2.
Expand Up @@ -110,7 +110,7 @@ init_per_group(detailed_metrics, Config0) ->
VHost1Conn = rabbit_ct_client_helpers:open_unmanaged_connection(Config1, 0, <<"vhost-1">>),
{ok, VHost1Ch} = amqp_connection:open_channel(VHost1Conn),

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

0 comments on commit 51402be

Please sign in to comment.