summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGerhard Lazu <gerhard@lazu.co.uk>2021-01-22 16:38:44 +0000
committerGerhard Lazu <gerhard@lazu.co.uk>2021-01-22 16:38:44 +0000
commitf3f3e8aae9cae828fc85205616608e1f7a75e904 (patch)
tree8d84bd0e685a454ce7c0de89abb85b6064a3608e
parent5a6e3f235b880f753a017515014bac6e993f87a4 (diff)
downloadrabbitmq-server-git-f3f3e8aae9cae828fc85205616608e1f7a75e904.tar.gz
Always show aggregated auth_attempts, add detailed when per object enabledsingle-auth-attempts-declarations-on-per-object_2740
The metrics have different names now, so we can't end up with duplicate TYPEs. Signed-off-by: Gerhard Lazu <gerhard@lazu.co.uk>
-rw-r--r--deps/rabbitmq_prometheus/src/collectors/prometheus_rabbitmq_core_metrics_collector.erl14
-rw-r--r--deps/rabbitmq_prometheus/test/rabbit_prometheus_http_SUITE.erl13
2 files changed, 11 insertions, 16 deletions
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 9c155bb030..ea69450dea 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
@@ -191,15 +191,15 @@
]},
{auth_attempt_metrics, [
- {2, undefined, auth_attempts_total, counter, "Total number of authorization attempts on a node"},
- {3, undefined, auth_attempts_succeeded_total, counter, "Total number of successful authentication attempts on a node"},
- {4, undefined, auth_attempts_failed_total, counter, "Total number of failed authentication attempts on a node"}
+ {2, undefined, auth_attempts_total, counter, "Total number of authorization attempts"},
+ {3, undefined, auth_attempts_succeeded_total, counter, "Total number of successful authentication attempts"},
+ {4, undefined, auth_attempts_failed_total, counter, "Total number of failed authentication attempts"}
]},
{auth_attempt_detailed_metrics, [
- {2, undefined, auth_attempts_total, counter, "Total number of authorization attempts on a node"},
- {3, undefined, auth_attempts_succeeded_total, counter, "Total number of successful authorization attempts on a node"},
- {4, undefined, auth_attempts_failed_total, counter, "Total number of failed authorization attempts on a node"}
+ {2, undefined, auth_attempts_detailed_total, counter, "Total number of authorization attempts with source info"},
+ {3, undefined, auth_attempts_detailed_succeeded_total, counter, "Total number of successful authorization attempts with source info"},
+ {4, undefined, auth_attempts_detailed_failed_total, counter, "Total number of failed authorization attempts with source info"}
]}
]).
@@ -240,8 +240,6 @@ collect(PerObjectMetrics, Callback) ->
add_metric_family(identity_info(), Callback),
ok.
-include_when_per_object_metrics(true, auth_attempt_metrics) ->
- false;
include_when_per_object_metrics(false, auth_attempt_detailed_metrics) ->
false;
include_when_per_object_metrics(_, _) ->
diff --git a/deps/rabbitmq_prometheus/test/rabbit_prometheus_http_SUITE.erl b/deps/rabbitmq_prometheus/test/rabbit_prometheus_http_SUITE.erl
index 06ddc9fc94..d786f1832a 100644
--- a/deps/rabbitmq_prometheus/test/rabbit_prometheus_http_SUITE.erl
+++ b/deps/rabbitmq_prometheus/test/rabbit_prometheus_http_SUITE.erl
@@ -36,8 +36,7 @@ groups() ->
]},
{per_object_metrics, [], [
globally_configure_per_object_metrics_test,
- specific_erlang_metrics_present_test,
- single_auth_attempts_type_test
+ specific_erlang_metrics_present_test
]},
{per_object_endpoint_metrics, [], [
endpoint_per_object_metrics,
@@ -218,6 +217,8 @@ aggregated_metrics_test(Config) ->
?assertEqual(match, re:run(Body, "^rabbitmq_raft_term_total ", [{capture, none}, multiline])),
?assertEqual(match, re:run(Body, "^rabbitmq_queue_messages_ready ", [{capture, none}, multiline])),
?assertEqual(match, re:run(Body, "^rabbitmq_queue_consumers ", [{capture, none}, multiline])),
+ ?assertEqual(match, re:run(Body, "TYPE rabbitmq_auth_attempts_total", [{capture, none}, multiline])),
+ ?assertEqual(nomatch, re:run(Body, "TYPE rabbitmq_auth_attempts_detailed_total", [{capture, none}, multiline])),
%% Check the first metric value in each ETS table that requires converting
?assertEqual(match, re:run(Body, "^rabbitmq_erlang_uptime_seconds ", [{capture, none}, multiline])),
?assertEqual(match, re:run(Body, "^rabbitmq_io_read_time_seconds_total ", [{capture, none}, multiline])),
@@ -252,6 +253,8 @@ per_object_metrics_test(Config, Path) ->
?assertEqual(match, re:run(Body, "^rabbitmq_raft_term_total{", [{capture, none}, multiline])),
?assertEqual(match, re:run(Body, "^rabbitmq_queue_messages_ready{", [{capture, none}, multiline])),
?assertEqual(match, re:run(Body, "^rabbitmq_queue_consumers{", [{capture, none}, multiline])),
+ ?assertEqual(match, re:run(Body, "TYPE rabbitmq_auth_attempts_total", [{capture, none}, multiline])),
+ ?assertEqual(match, re:run(Body, "TYPE rabbitmq_auth_attempts_detailed_total", [{capture, none}, multiline])),
%% Check the first metric value in each ETS table that requires converting
?assertEqual(match, re:run(Body, "^rabbitmq_erlang_uptime_seconds ", [{capture, none}, multiline])),
?assertEqual(match, re:run(Body, "^rabbitmq_io_read_time_seconds_total ", [{capture, none}, multiline])),
@@ -259,12 +262,6 @@ per_object_metrics_test(Config, Path) ->
%% Check the first TOTALS metric value
?assertEqual(match, re:run(Body, "^rabbitmq_connections ", [{capture, none}, multiline])).
-single_auth_attempts_type_test(Config) ->
- {_Headers, Body} = http_get_with_pal(Config, [], 200),
- TypeDefinition = "TYPE rabbitmq_auth_attempts_total",
- {match, Matches} = re:run(Body, TypeDefinition, [{capture, all, binary}, global]),
- ?assertEqual(1, length(Matches), "Expecting a single occurence of " ++ TypeDefinition).
-
build_info_test(Config) ->
{_Headers, Body} = http_get_with_pal(Config, [], 200),
?assertEqual(match, re:run(Body, "^rabbitmq_build_info{", [{capture, none}, multiline])),