Skip to content

Commit 27e4d4b

Browse files
HTTP API: make GET /api/aliveness-test a no-op
This follows the decision that was made for 'rabbitm-diagnostics node_health_check' which is a no-op as of 4.0.0 following a few years of deprecation. The justification is very similar: 1. There is no such thing as "One True Health Check". A single health check is too coarse-grained to explain what specifically is not right about cluster state 2. Indivual fine-grained health checks have been available for a few years now, see https://www.rabbitmq.com/docs/monitoring#health-checks 3. This particular check tests something that effectively never fails, based on my 14+ years of RabbitMQ contributions and user support of all shapes and forms 4. This check uses a deprecated feature: non-exclusive non-durable/transient classic queues If something about this health check is worth preserving, we can always add a new one under GET /api/health/checks/* Closes #13047.
1 parent e5fe724 commit 27e4d4b

File tree

1 file changed

+4
-26
lines changed

1 file changed

+4
-26
lines changed

deps/rabbitmq_management/src/rabbit_mgmt_wm_aliveness_test.erl

Lines changed: 4 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -35,37 +35,15 @@ resource_exists(ReqData, Context) ->
3535
end, ReqData, Context}.
3636

3737
to_json(ReqData, Context) ->
38+
%% This health check is deprecated and is now a no-op.
39+
%% More specific health checks under GET /api/health/checks/* should be used instead.
40+
%% https://www.rabbitmq.com/docs/monitoring#health-checks
3841
rabbit_mgmt_util:with_channel(
3942
rabbit_mgmt_util:vhost(ReqData),
4043
ReqData,
4144
Context,
42-
fun(Ch) ->
43-
#'queue.declare_ok'{queue = ?QUEUE} = amqp_channel:call(Ch, #'queue.declare'{
44-
queue = ?QUEUE
45-
}),
46-
ok = amqp_channel:call(Ch, #'basic.publish'{routing_key = ?QUEUE}, #amqp_msg{
47-
payload = <<"test_message">>
48-
}),
49-
case amqp_channel:call(Ch, #'basic.get'{queue = ?QUEUE, no_ack = true}) of
50-
{#'basic.get_ok'{}, _} ->
51-
%% Don't delete the queue. If this is pinged every few
52-
%% seconds we don't want to create a mnesia transaction
53-
%% each time.
54-
rabbit_mgmt_util:reply([{status, ok}], ReqData, Context);
55-
#'basic.get_empty'{} ->
56-
Reason = <<"aliveness-test queue is empty">>,
57-
failure(Reason, ReqData, Context);
58-
Error ->
59-
Reason = rabbit_data_coercion:to_binary(Error),
60-
failure(Reason, ReqData, Context)
61-
end
62-
end
45+
fun(_Ch) -> rabbit_mgmt_util:reply([{status, ok}], ReqData, Context) end
6346
).
6447

65-
failure(Reason, ReqData0, Context0) ->
66-
Body = #{status => failed, reason => Reason},
67-
{Response, ReqData1, Context1} = rabbit_mgmt_util:reply(Body, ReqData0, Context0),
68-
{stop, cowboy_req:reply(?HEALTH_CHECK_FAILURE_STATUS, #{}, Response, ReqData1), Context1}.
69-
7048
is_authorized(ReqData, Context) ->
7149
rabbit_mgmt_util:is_authorized_vhost(ReqData, Context).

0 commit comments

Comments
 (0)