Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 18 additions & 6 deletions deps/rabbit/test/metrics_SUITE.erl
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,8 @@ merge_app_env(Config) ->
rabbit_ct_helpers:merge_app_env(Config,
{rabbit, [
{collect_statistics, fine},
{collect_statistics_interval, 500}
{collect_statistics_interval, 500},
{core_metrics_gc_interval, 5000}
]}).
init_per_suite(Config) ->
rabbit_ct_helpers:log_environment(),
Expand Down Expand Up @@ -186,6 +187,10 @@ queue_metric_idemp(Config, {N, R}) ->
Queue
end || _ <- lists:seq(1, N)],

?awaitMatch(N, length(read_table_rpc(Config, queue_metrics)),
30000),
?awaitMatch(N, length(read_table_rpc(Config, queue_coarse_metrics)),
30000),
Table = [ Pid || {Pid, _, _} <- read_table_rpc(Config, queue_metrics)],
Table2 = [ Pid || {Pid, _, _} <- read_table_rpc(Config, queue_coarse_metrics)],
% refresh stats 'R' times
Expand All @@ -195,12 +200,16 @@ queue_metric_idemp(Config, {N, R}) ->
gen_server2:call(Pid, flush)
end|| {Pid, _, _} <- ChanTable ] || _ <- lists:seq(1, R)],
force_metric_gc(Config),
?awaitMatch(N, length(read_table_rpc(Config, queue_metrics)),
30000),
?awaitMatch(N, length(read_table_rpc(Config, queue_coarse_metrics)),
30000),
TableAfter = [ Pid || {Pid, _, _} <- read_table_rpc(Config, queue_metrics)],
TableAfter2 = [ Pid || {Pid, _, _} <- read_table_rpc(Config, queue_coarse_metrics)],
[ delete_queue(Chan, Q) || Q <- Queues],
rabbit_ct_client_helpers:close_connection(Conn),
(Table2 == TableAfter2) and (Table == TableAfter) and
(N == length(Table)) and (N == length(TableAfter)).
(lists:sort(Table2) == lists:sort(TableAfter2))
and (lists:sort(Table) == lists:sort(TableAfter)).

connection_metric_count(Config, Ops) ->
add_rem_counter(Config, Ops,
Expand Down Expand Up @@ -293,9 +302,12 @@ connection(Config) ->
[_] = read_table_rpc(Config, connection_coarse_metrics),
ok = rabbit_ct_client_helpers:close_connection(Conn),
force_metric_gc(Config),
[] = read_table_rpc(Config, connection_created),
[] = read_table_rpc(Config, connection_metrics),
[] = read_table_rpc(Config, connection_coarse_metrics),
?awaitMatch([], read_table_rpc(Config, connection_created),
30000),
?awaitMatch([], read_table_rpc(Config, connection_metrics),
30000),
?awaitMatch([], read_table_rpc(Config, connection_coarse_metrics),
30000),
ok.

channel(Config) ->
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -101,8 +101,10 @@ single_link_then_second_added(Config) ->
timer:sleep(3000),
[_L1] = rabbit_ct_broker_helpers:rpc(Config, 0,
rabbit_federation_status, status, []),
MFs = get_metrics(Config),
[?ONE_RUNNING_METRIC] = MFs,
rabbit_ct_helpers:eventually(?_assertEqual([?ONE_RUNNING_METRIC],
get_metrics(Config)),
500,
5),
maybe_declare_queue(Config, Ch, q(<<"fed.downstream2">>, [{<<"x-queue-type">>, longstr, <<"classic">>}])),
%% here we race against queue.declare... most of the times there is going to be
%% new status=starting metric. In this case we wait a bit more for running=2.
Expand Down
Loading