Skip to content

Commit

Permalink
Merge branch 'v3.13.x' into mergify/bp/v3.13.x/pr-12611
Browse files Browse the repository at this point in the history
  • Loading branch information
michaelklishin authored Oct 31, 2024
2 parents f5aeeaa + b1c9890 commit 9d1449c
Show file tree
Hide file tree
Showing 4 changed files with 24 additions and 9 deletions.
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
1 change: 1 addition & 0 deletions deps/rabbit_common/mk/rabbitmq-run.mk
Original file line number Diff line number Diff line change
Expand Up @@ -436,6 +436,7 @@ restart-cluster:
-rabbitmq_prometheus tcp_config [{port,$$((15692 + $$n - 1))}] \
-rabbitmq_stream tcp_listeners [$$((5552 + $$n - 1))] \
"; \
$(RABBITMQCTL) -n "$$nodename" await_online_nodes $(NODES) || exit 1; \
done; \
wait

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
Original file line number Diff line number Diff line change
Expand Up @@ -239,7 +239,7 @@ init_per_group(special_chars, Config0) ->
{connection, VHostConn},
{channel, VHostCh}
|Config1],
init_per_group(special_chars, Config2, []);
Config2;

init_per_group(authentication, Config) ->
Config1 = rabbit_ct_helpers:merge_app_env(
Expand Down

0 comments on commit 9d1449c

Please sign in to comment.