Skip to content

Commit eec592f

Browse files
committed
Scrub connection counts and limits from public API health checks
1 parent 8805cdd commit eec592f

File tree

3 files changed

+5
-19
lines changed

3 files changed

+5
-19
lines changed

deps/rabbitmq_management/src/rabbit_mgmt_wm_health_check_below_node_connection_limit.erl

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -34,16 +34,11 @@ to_json(ReqData, Context) ->
3434
Limit = rabbit_misc:get_env(rabbit, connection_max, infinity),
3535
case ActiveConns < Limit of
3636
true ->
37-
rabbit_mgmt_util:reply(
38-
#{status => ok,
39-
limit => Limit,
40-
connections => ActiveConns}, ReqData, Context);
37+
rabbit_mgmt_util:reply(#{status => ok}, ReqData, Context);
4138
false ->
4239
Body = #{
4340
status => failed,
44-
reason => <<"node connection limit is reached">>,
45-
limit => Limit,
46-
connections => ActiveConns
41+
reason => <<"node connection limit is reached">>
4742
},
4843
{Response, ReqData1, Context1} = rabbit_mgmt_util:reply(
4944
Body, ReqData, Context),

deps/rabbitmq_management/src/rabbit_mgmt_wm_health_check_ready_to_serve_clients.erl

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -33,8 +33,8 @@ content_types_provided(ReqData, Context) ->
3333

3434
to_json(ReqData, Context) ->
3535
case check() of
36-
{ok, Body} ->
37-
rabbit_mgmt_util:reply(Body, ReqData, Context);
36+
ok ->
37+
rabbit_mgmt_util:reply(#{status => ok}, ReqData, Context);
3838
{error, Body} ->
3939
{Response, ReqData1, Context1} = rabbit_mgmt_util:reply(
4040
Body, ReqData, Context),
@@ -62,13 +62,10 @@ check() ->
6262
Limit = rabbit_misc:get_env(rabbit, connection_max, infinity),
6363
case ActiveConns < Limit of
6464
true ->
65-
{ok, #{status => ok,
66-
limit => Limit,
67-
connections => ActiveConns}};
65+
ok;
6866
false ->
6967
{error, #{status => failed,
7068
reason => <<"node connection limit is reached">>,
71-
limit => Limit,
7269
connections => ActiveConns}}
7370
end;
7471
[] ->

deps/rabbitmq_management/test/rabbit_mgmt_http_health_checks_SUITE.erl

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -476,8 +476,6 @@ below_node_connection_limit_test(Config) ->
476476
Path = "/health/checks/below-node-connection-limit",
477477
Check0 = http_get(Config, Path, ?OK),
478478
?assertEqual(<<"ok">>, maps:get(status, Check0)),
479-
?assertEqual(0, maps:get(connections, Check0)),
480-
?assertEqual(<<"infinity">>, maps:get(limit, Check0)),
481479

482480
%% Set the connection limit low and open 'limit' connections.
483481
Limit = 10,
@@ -489,8 +487,6 @@ below_node_connection_limit_test(Config) ->
489487

490488
Body0 = http_get_failed(Config, Path),
491489
?assertEqual(<<"failed">>, maps:get(<<"status">>, Body0)),
492-
?assertEqual(10, maps:get(<<"limit">>, Body0)),
493-
?assertEqual(10, maps:get(<<"connections">>, Body0)),
494490

495491
%% Clean up the connections and reset the limit.
496492
[catch rabbit_ct_client_helpers:close_connection(C) || C <- Connections],
@@ -519,8 +515,6 @@ ready_to_serve_clients_test(Config) ->
519515

520516
Body1 = http_get_failed(Config, Path),
521517
?assertEqual(<<"failed">>, maps:get(<<"status">>, Body1)),
522-
?assertEqual(10, maps:get(<<"limit">>, Body1)),
523-
?assertEqual(10, maps:get(<<"connections">>, Body1)),
524518

525519
%% Clean up the connections and reset the limit.
526520
[catch rabbit_ct_client_helpers:close_connection(C) || C <- Connections],

0 commit comments

Comments
 (0)