Skip to content

Commit 1084179

Browse files
committed
Log leader health check result in broker logs (if any leaderless queues)
1 parent 1736845 commit 1084179

File tree

1 file changed

+8
-1
lines changed

1 file changed

+8
-1
lines changed

deps/rabbit/src/rabbit_quorum_queue.erl

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2179,7 +2179,9 @@ leader_health_check(QueueNameOrRegEx, VHost, ProcessLimitThreshold) ->
21792179
[]
21802180
end
21812181
end || Q <- Qs, amqqueue:get_type(Q) == ?MODULE]),
2182-
wait_for_leader_health_checks(HealthCheckRef, length(HealthCheckPids), []).
2182+
Result = wait_for_leader_health_checks(HealthCheckRef, length(HealthCheckPids), []),
2183+
_ = spawn(fun() -> maybe_log_leader_health_check_result(Result) end),
2184+
Result.
21832185

21842186
run_leader_health_check(ClusterName, QResource, HealthCheckRef, From) ->
21852187
Leader = ra_leaderboard:lookup_leader(ClusterName),
@@ -2215,3 +2217,8 @@ check_process_limit_safety(QCount, ProcessLimitThreshold) ->
22152217
false ->
22162218
ok
22172219
end.
2220+
2221+
maybe_log_leader_health_check_result([]) -> ok;
2222+
maybe_log_leader_health_check_result(Result) ->
2223+
Qs = lists:map(fun(R) -> catch maps:get(<<"readable_name">>, R) end, Result),
2224+
rabbit_log:warning("Leader health check result (unhealthy leaders detected): ~ts", [Qs]).

0 commit comments

Comments
 (0)