Add rabbitmq_endpoint label to rabbitmq_identity_info

This commit is contained in:
Michal Kuratczyk 2025-02-07 15:51:40 +01:00
parent 3a17473a95
commit 703ee8529e
No known key found for this signature in database
1 changed files with 12 additions and 8 deletions

View File

@ -304,22 +304,25 @@ collect_mf('detailed', Callback) ->
collect(true, ?DETAILED_METRIC_NAME_PREFIX, vhosts_filter_from_pdict(), enabled_mfs_from_pdict(?METRICS_RAW), Callback), collect(true, ?DETAILED_METRIC_NAME_PREFIX, vhosts_filter_from_pdict(), enabled_mfs_from_pdict(?METRICS_RAW), Callback),
collect(true, ?CLUSTER_METRIC_NAME_PREFIX, vhosts_filter_from_pdict(), enabled_mfs_from_pdict(?METRICS_CLUSTER), Callback), collect(true, ?CLUSTER_METRIC_NAME_PREFIX, vhosts_filter_from_pdict(), enabled_mfs_from_pdict(?METRICS_CLUSTER), Callback),
%% identity is here to enable filtering on a cluster name (as already happens in existing dashboards) %% identity is here to enable filtering on a cluster name (as already happens in existing dashboards)
emit_identity_info(Callback), emit_identity_info(<<"detailed">>, Callback),
ok; ok;
collect_mf('per-object', Callback) -> collect_mf('per-object', Callback) ->
collect(true, ?METRIC_NAME_PREFIX, false, ?METRICS_RAW, Callback), collect(true, ?METRIC_NAME_PREFIX, false, ?METRICS_RAW, Callback),
totals(Callback), totals(Callback),
emit_identity_info(Callback), emit_identity_info(<<"per-object">>, Callback),
ok; ok;
collect_mf('memory-breakdown', Callback) -> collect_mf('memory-breakdown', Callback) ->
collect(false, ?METRIC_NAME_PREFIX, false, ?METRICS_MEMORY_BREAKDOWN, Callback), collect(false, ?METRIC_NAME_PREFIX, false, ?METRICS_MEMORY_BREAKDOWN, Callback),
emit_identity_info(Callback), emit_identity_info(<<"memory-breakdown">>, Callback),
ok; ok;
collect_mf(_Registry, Callback) -> collect_mf(_Registry, Callback) ->
PerObjectMetrics = application:get_env(rabbitmq_prometheus, return_per_object_metrics, false), PerObjectMetrics = application:get_env(rabbitmq_prometheus, return_per_object_metrics, false),
collect(PerObjectMetrics, ?METRIC_NAME_PREFIX, false, ?METRICS_RAW, Callback), collect(PerObjectMetrics, ?METRIC_NAME_PREFIX, false, ?METRICS_RAW, Callback),
totals(Callback), totals(Callback),
emit_identity_info(Callback), case PerObjectMetrics of
true -> emit_identity_info(<<"per-object">>, Callback);
false -> emit_identity_info(<<"aggregated">>, Callback)
end,
ok. ok.
collect(PerObjectMetrics, Prefix, VHostsFilter, IncludedMFs, Callback) -> collect(PerObjectMetrics, Prefix, VHostsFilter, IncludedMFs, Callback) ->
@ -336,9 +339,9 @@ totals(Callback) ->
end || {Table, Name, Type, Help} <- ?TOTALS], end || {Table, Name, Type, Help} <- ?TOTALS],
ok. ok.
emit_identity_info(Callback) -> emit_identity_info(Endpoint, Callback) ->
add_metric_family(build_info(), Callback), add_metric_family(build_info(), Callback),
add_metric_family(identity_info(), Callback), add_metric_family(identity_info(Endpoint), Callback),
ok. ok.
%% Aggregated `auth``_attempt_detailed_metrics` and %% Aggregated `auth``_attempt_detailed_metrics` and
@ -387,7 +390,7 @@ build_info() ->
}] }]
}. }.
identity_info() -> identity_info(Endpoint) ->
{ {
identity_info, identity_info,
untyped, untyped,
@ -396,7 +399,8 @@ identity_info() ->
[ [
{rabbitmq_node, node()}, {rabbitmq_node, node()},
{rabbitmq_cluster, rabbit_nodes:cluster_name()}, {rabbitmq_cluster, rabbit_nodes:cluster_name()},
{rabbitmq_cluster_permanent_id, rabbit_nodes:persistent_cluster_id()} {rabbitmq_cluster_permanent_id, rabbit_nodes:persistent_cluster_id()},
{rabbitmq_endpoint, Endpoint}
], ],
1 1
}] }]