diff --git a/deps/rabbitmq_prometheus/src/collectors/prometheus_rabbitmq_core_metrics_collector.erl b/deps/rabbitmq_prometheus/src/collectors/prometheus_rabbitmq_core_metrics_collector.erl index 9ea8fcfa2d3a..1f4534495e85 100644 --- a/deps/rabbitmq_prometheus/src/collectors/prometheus_rabbitmq_core_metrics_collector.erl +++ b/deps/rabbitmq_prometheus/src/collectors/prometheus_rabbitmq_core_metrics_collector.erl @@ -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, ?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) - emit_identity_info(Callback), + emit_identity_info(<<"detailed">>, Callback), ok; collect_mf('per-object', Callback) -> collect(true, ?METRIC_NAME_PREFIX, false, ?METRICS_RAW, Callback), totals(Callback), - emit_identity_info(Callback), + emit_identity_info(<<"per-object">>, Callback), ok; collect_mf('memory-breakdown', Callback) -> collect(false, ?METRIC_NAME_PREFIX, false, ?METRICS_MEMORY_BREAKDOWN, Callback), - emit_identity_info(Callback), + emit_identity_info(<<"memory-breakdown">>, Callback), ok; collect_mf(_Registry, Callback) -> PerObjectMetrics = application:get_env(rabbitmq_prometheus, return_per_object_metrics, false), collect(PerObjectMetrics, ?METRIC_NAME_PREFIX, false, ?METRICS_RAW, 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. collect(PerObjectMetrics, Prefix, VHostsFilter, IncludedMFs, Callback) -> @@ -336,9 +339,9 @@ totals(Callback) -> end || {Table, Name, Type, Help} <- ?TOTALS], ok. -emit_identity_info(Callback) -> +emit_identity_info(Endpoint, Callback) -> add_metric_family(build_info(), Callback), - add_metric_family(identity_info(), Callback), + add_metric_family(identity_info(Endpoint), Callback), ok. %% Aggregated `auth``_attempt_detailed_metrics` and @@ -387,7 +390,7 @@ build_info() -> }] }. -identity_info() -> +identity_info(Endpoint) -> { identity_info, untyped, @@ -396,7 +399,8 @@ identity_info() -> [ {rabbitmq_node, node()}, {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 }]