Release series support: announce in more places

* Log file on boot
 * Startup banner
 * HTTP API response @ GET /api/overview
This commit is contained in:
Michael Klishin 2022-08-28 02:13:42 +04:00
parent fc0de65393
commit 25e5182801
3 changed files with 28 additions and 8 deletions

View File

@ -691,10 +691,7 @@ status() ->
[Tuple] when is_tuple(Tuple) -> Tuple; [Tuple] when is_tuple(Tuple) -> Tuple;
Tuple when is_tuple(Tuple) -> Tuple Tuple when is_tuple(Tuple) -> Tuple
end, end,
SeriesSupportStatus = case rabbit_release_series:is_currently_supported() of SeriesSupportStatus = rabbit_release_series:readable_support_status(),
false -> <<"out of support">>;
_ -> <<"supported">>
end,
S1 = [{pid, list_to_integer(os:getpid())}, S1 = [{pid, list_to_integer(os:getpid())},
%% The timeout value used is twice that of gen_server:call/2. %% The timeout value used is twice that of gen_server:call/2.
{running_applications, rabbit_misc:which_applications()}, {running_applications, rabbit_misc:which_applications()},
@ -865,6 +862,7 @@ start(normal, []) ->
?COPYRIGHT_MESSAGE, ?INFORMATION_MESSAGE], ?COPYRIGHT_MESSAGE, ?INFORMATION_MESSAGE],
#{domain => ?RMQLOG_DOMAIN_PRELAUNCH}) #{domain => ?RMQLOG_DOMAIN_PRELAUNCH})
end, end,
maybe_warn_about_release_series_eol(),
log_motd(), log_motd(),
{ok, SupPid} = rabbit_sup:start_link(), {ok, SupPid} = rabbit_sup:start_link(),
@ -1188,6 +1186,7 @@ print_banner() ->
%% padded list lines %% padded list lines
{LogFmt, LogLocations} = LineListFormatter("~n ~ts", log_locations()), {LogFmt, LogLocations} = LineListFormatter("~n ~ts", log_locations()),
{CfgFmt, CfgLocations} = LineListFormatter("~n ~ts", config_locations()), {CfgFmt, CfgLocations} = LineListFormatter("~n ~ts", config_locations()),
SeriesSupportStatus = rabbit_release_series:readable_support_status(),
{MOTDFormat, MOTDArgs} = case motd() of {MOTDFormat, MOTDArgs} = case motd() of
undefined -> undefined ->
{"", []}; {"", []};
@ -1205,6 +1204,7 @@ print_banner() ->
MOTDFormat ++ MOTDFormat ++
"~n Erlang: ~ts [~ts]" "~n Erlang: ~ts [~ts]"
"~n TLS Library: ~ts" "~n TLS Library: ~ts"
"~n Release series support status: ~ts"
"~n" "~n"
"~n Doc guides: https://rabbitmq.com/documentation.html" "~n Doc guides: https://rabbitmq.com/documentation.html"
"~n Support: https://rabbitmq.com/contact.html" "~n Support: https://rabbitmq.com/contact.html"
@ -1215,11 +1215,22 @@ print_banner() ->
"~n Config file(s): ~ts" ++ CfgFmt ++ "~n" "~n Config file(s): ~ts" ++ CfgFmt ++ "~n"
"~n Starting broker...", "~n Starting broker...",
[Product, Version, ?COPYRIGHT_MESSAGE, ?INFORMATION_MESSAGE] ++ [Product, Version, ?COPYRIGHT_MESSAGE, ?INFORMATION_MESSAGE] ++
[rabbit_misc:otp_release(), emu_flavor(), crypto_version()] ++ [rabbit_misc:otp_release(), emu_flavor(), crypto_version(),
SeriesSupportStatus] ++
MOTDArgs ++ MOTDArgs ++
LogLocations ++ LogLocations ++
CfgLocations). CfgLocations).
maybe_warn_about_release_series_eol() ->
case rabbit_release_series:is_currently_supported() of
false ->
?LOG_WARNING("This release series has reached end of life "
"and is no longer supported. "
"Please visit https://rabbitmq.com/versions.html "
"to learn more and upgrade");
_ -> ok
end.
emu_flavor() -> emu_flavor() ->
%% emu_flavor was introduced in Erlang 24 so we need to catch the error on Erlang 23 %% 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 case catch(erlang:system_info(emu_flavor)) of

View File

@ -11,7 +11,8 @@
-export([ -export([
eol_date/0, eol_date/0,
is_currently_supported/0 is_currently_supported/0,
readable_support_status/0
]). ]).
-spec eol_date() -> rabbit_types:maybe(calendar:date()). -spec eol_date() -> rabbit_types:maybe(calendar:date()).
@ -29,3 +30,10 @@ is_currently_supported() ->
none -> true; none -> true;
Date -> not rabbit_date_time:is_in_the_past(Date) Date -> not rabbit_date_time:is_in_the_past(Date)
end. end.
-spec readable_support_status() -> binary().
readable_support_status() ->
case is_currently_supported() of
false -> <<"out of support">>;
_ -> <<"supported">>
end.

View File

@ -49,8 +49,9 @@ to_json(ReqData, Context = #context{user = User = #user{tags = Tags}}) ->
{cluster_name, rabbit_nodes:cluster_name()}, {cluster_name, rabbit_nodes:cluster_name()},
{erlang_version, erlang_version()}, {erlang_version, erlang_version()},
{erlang_full_version, erlang_full_version()}, {erlang_full_version, erlang_full_version()},
{disable_stats, rabbit_mgmt_util:disable_stats(ReqData)}, {release_series_support_status, rabbit_release_series:readable_support_status()},
{enable_queue_totals, rabbit_mgmt_util:enable_queue_totals(ReqData)}], {disable_stats, rabbit_mgmt_util:disable_stats(ReqData)},
{enable_queue_totals, rabbit_mgmt_util:enable_queue_totals(ReqData)}],
try try
case rabbit_mgmt_util:disable_stats(ReqData) of case rabbit_mgmt_util:disable_stats(ReqData) of
false -> false ->