Skip to content

Commit db9cbc4

Browse files
committed
wip
1 parent 28cc121 commit db9cbc4

File tree

3 files changed

+52
-1
lines changed

3 files changed

+52
-1
lines changed

deps/rabbit/priv/schema/rabbit.schema

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2688,6 +2688,20 @@ fun(Conf) ->
26882688
end
26892689
end}.
26902690

2691+
{mapping, "cluster_tags.$tag", "rabbit.cluster_tags", [
2692+
{datatype, [string]}
2693+
]}.
2694+
2695+
{translation, "rabbit.cluster_tags",
2696+
fun(Conf) ->
2697+
case cuttlefish:conf_get("cluster_tags", Conf, undefined) of
2698+
none -> [];
2699+
_ ->
2700+
Settings = cuttlefish_variable:filter_by_prefix("cluster_tags", Conf),
2701+
[ {K, V} || {[_, K], V} <- Settings]
2702+
end
2703+
end}.
2704+
26912705
% ===============================
26922706
% Validators
26932707
% ===============================

deps/rabbitmq_management/src/rabbit_mgmt_wm_overview.erl

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,7 @@ to_json(ReqData, Context = #context{user = User = #user{tags = Tags}}) ->
4747
{product_name, list_to_binary(rabbit:product_name())},
4848
{rabbitmq_version, list_to_binary(rabbit:base_product_version())},
4949
{cluster_name, rabbit_nodes:cluster_name()},
50+
{cluster_tags, cluster_tags()},
5051
{erlang_version, erlang_version()},
5152
{erlang_full_version, erlang_full_version()},
5253
{release_series_support_status, rabbit_release_series:readable_support_status()},
@@ -182,3 +183,14 @@ transform_retention_intervals([{MaxAgeInSeconds, _}|Rest], Acc) ->
182183
0
183184
end,
184185
transform_retention_intervals(Rest, [AccVal|Acc]).
186+
187+
cluster_tags() ->
188+
case application:get_env(rabbit, cluster_tags) of
189+
undefined ->
190+
[];
191+
{ok, Tags} ->
192+
lists:map(fun({K, V}) ->
193+
{list_to_binary(K), list_to_binary(V)}
194+
end,
195+
Tags)
196+
end.

deps/rabbitmq_prometheus/src/collectors/prometheus_rabbitmq_core_metrics_collector.erl

Lines changed: 26 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -334,6 +334,7 @@ totals(Callback) ->
334334
emit_identity_info(Callback) ->
335335
add_metric_family(build_info(), Callback),
336336
add_metric_family(identity_info(), Callback),
337+
lists:foreach(fun(Tag) -> add_metric_family(Tag, Callback) end, tag_info()),
337338
ok.
338339

339340
%% Aggregated `auth``_attempt_detailed_metrics` and
@@ -397,6 +398,31 @@ identity_info() ->
397398
}]
398399
}.
399400

401+
tag_info() ->
402+
[{
403+
tag_info,
404+
untyped,
405+
"RabbitMQ node tag info",
406+
[{
407+
[
408+
{rabbitmq_tags, <<"tag1">>}
409+
],
410+
1
411+
}]
412+
},
413+
{
414+
tag_info,
415+
untyped,
416+
"RabbitMQ node tag info",
417+
[{
418+
[
419+
{rabbitmq_tags, <<"tag2">>}
420+
],
421+
1
422+
}]
423+
}
424+
].
425+
400426
add_metric_family({Name, Type, Help, Metrics}, Callback) ->
401427
MN = <<?METRIC_NAME_PREFIX/binary, (prometheus_model_helpers:metric_name(Name))/binary>>,
402428
Callback(create_mf(MN, Help, Type, Metrics)).
@@ -854,4 +880,3 @@ vhosts_filter_from_pdict() ->
854880
Enabled = maps:from_list([ {VHost, true} || VHost <- L ]),
855881
maps:merge(All, Enabled)
856882
end.
857-

0 commit comments

Comments
 (0)