Always show aggregated auth_attempts, add detailed when per object enabled
The metrics have different names now, so we can't end up with duplicate TYPEs. Signed-off-by: Gerhard Lazu <gerhard@lazu.co.uk>
This commit is contained in:
parent
5a6e3f235b
commit
f3f3e8aae9
|
@ -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(_, _) ->
|
||||
|
|
|
@ -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])),
|
||||
|
|
Loading…
Reference in New Issue