Skip to content

Commit

Permalink
Merge pull request #11387 from rabbitmq/mergify/bp/v3.13.x/pr-11386
Browse files Browse the repository at this point in the history
rabbitmq-diagnostics status: adjust the (date-based) support status field to match the current community support policy (backport #11386)
  • Loading branch information
michaelklishin authored Jun 6, 2024
2 parents c4b3daa + 53c67ce commit 1ea136b
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 37 deletions.
20 changes: 2 additions & 18 deletions deps/rabbit/src/rabbit.erl
Original file line number Diff line number Diff line change
Expand Up @@ -705,15 +705,13 @@ maybe_print_boot_progress(true, IterationsLeft) ->
status() ->
Version = base_product_version(),
[CryptoLibInfo] = crypto:info_lib(),
SeriesSupportStatus = rabbit_release_series:readable_support_status(),
S1 = [{pid, list_to_integer(os:getpid())},
%% The timeout value used is twice that of gen_server:call/2.
{running_applications, rabbit_misc:which_applications()},
{os, os:type()},
{rabbitmq_version, Version},
{crypto_lib_info, CryptoLibInfo},
{erlang_version, erlang:system_info(system_version)},
{release_series_support_status, SeriesSupportStatus},
{memory, rabbit_vm:memory()},
{alarms, alarms()},
{is_under_maintenance, rabbit_maintenance:is_being_drained_local_read(node())},
Expand Down Expand Up @@ -912,7 +910,6 @@ start(normal, []) ->
?COPYRIGHT_MESSAGE, ?INFORMATION_MESSAGE],
#{domain => ?RMQLOG_DOMAIN_PRELAUNCH})
end,
maybe_warn_about_release_series_eol(),
log_motd(),
{ok, SupPid} = rabbit_sup:start_link(),

Expand Down Expand Up @@ -1269,7 +1266,6 @@ print_banner() ->
%% padded list lines
{LogFmt, LogLocations} = LineListFormatter("~n ~ts", log_locations()),
{CfgFmt, CfgLocations} = LineListFormatter("~n ~ts", config_locations()),
SeriesSupportStatus = rabbit_release_series:readable_support_status(),
{MOTDFormat, MOTDArgs} = case motd() of
undefined ->
{"", []};
Expand All @@ -1287,7 +1283,7 @@ print_banner() ->
MOTDFormat ++
"~n Erlang: ~ts [~ts]"
"~n TLS Library: ~ts"
"~n Release series support status: ~ts"
"~n Release series support status: see https://www.rabbitmq.com/release-information"
"~n"
"~n Doc guides: https://www.rabbitmq.com/docs"
"~n Support: https://www.rabbitmq.com/docs/contact"
Expand All @@ -1299,23 +1295,11 @@ print_banner() ->
"~n Config file(s): ~ts" ++ CfgFmt ++ "~n"
"~n Starting broker...",
[Product, Version, ?COPYRIGHT_MESSAGE, ?INFORMATION_MESSAGE] ++
[rabbit_misc:otp_release(), emu_flavor(), crypto_version(),
SeriesSupportStatus] ++
[rabbit_misc:otp_release(), emu_flavor(), crypto_version()] ++
MOTDArgs ++
LogLocations ++
CfgLocations).

maybe_warn_about_release_series_eol() ->
case rabbit_release_series:is_currently_supported() of
false ->
%% we intentionally log this as an error for increased visibiity
?LOG_ERROR("This release series has reached end of life "
"and is no longer supported. "
"Please visit https://www.rabbitmq.com/release-information "
"to learn more and upgrade");
_ -> ok
end.

emu_flavor() ->
%% emu_flavor was introduced in Erlang 24 so we need to catch the error on Erlang 23
case catch(erlang:system_info(emu_flavor)) of
Expand Down
22 changes: 4 additions & 18 deletions deps/rabbit/src/rabbit_release_series.erl
Original file line number Diff line number Diff line change
Expand Up @@ -10,30 +10,16 @@
-define(EOL_DATE_KEY, release_series_eol_date).

-export([
eol_date/0,
is_currently_supported/0,
readable_support_status/0
]).

-spec eol_date() -> rabbit_types:maybe(calendar:date()).
eol_date() ->
case application:get_env(rabbit, ?EOL_DATE_KEY) of
undefined -> none;
{ok, none} -> none;
{ok, {_Y, _M, _D} = Date} -> Date;
_ -> none
end.

%% Retained for backwards compatibility with older CLI tools.
-spec is_currently_supported() -> boolean().
is_currently_supported() ->
case eol_date() of
none -> true;
Date -> not rabbit_date_time:is_in_the_past(Date)
end.
true.

%% Retained for backwards compatibility with older CLI tools.
-spec readable_support_status() -> binary().
readable_support_status() ->
case is_currently_supported() of
false -> <<"out of support">>;
_ -> <<"supported">>
end.
<<"supported">>.
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,7 @@ defmodule RabbitMQ.CLI.Ctl.Commands.StatusCommand do
product_version_section ++
[
"RabbitMQ version: #{m[:rabbitmq_version]}",
"RabbitMQ release series support status: #{m[:release_series_support_status]}",
"RabbitMQ release series support status: see https://www.rabbitmq.com/release-information",
"Node name: #{node_name}",
"Erlang configuration: #{m[:erlang_version]}",
"Crypto library: #{m[:crypto_lib_version]}",
Expand Down

0 comments on commit 1ea136b

Please sign in to comment.