Skip to content

Commit 5370370

Browse files
committed
rabbit_feature_flags: Hide required feature flags from the registry init logged list
[Why] Showing that required feature flags are enabled over and over is not useful and only adds noise to the logs. [How] Required feature flags and removed deprecated features are not lists explicitly. We just log their respective numbers to still be clear that they exist. Before: list of feature flags found: [x] classic_mirrored_queue_version [x] classic_queue_type_delivery_support [x] direct_exchange_routing_v2 [x] feature_flags_v2 [x] implicit_default_bindings [ ] khepri_db [x] message_containers_deaths_v2 [x] quorum_queue_non_voters [~] rabbit_exchange_type_local_random [x] rabbitmq_4.0.0 ... list of deprecated features found: [ ] amqp_address_v1 [x] classic_queue_mirroring [ ] global_qos [ ] queue_master_locator [ ] ram_node_type [ ] transient_nonexcl_queues After: list of feature flags found: [ ] khepri_db [x] message_containers_deaths_v2 [x] quorum_queue_non_voters [~] rabbit_exchange_type_local_random [x] rabbitmq_4.0.0 list of deprecated features found: [ ] amqp_address_v1 [ ] global_qos [ ] queue_master_locator [ ] ram_node_type [ ] transient_nonexcl_queues required feature flags not listed above: 18 removed deprecated features not listed above: 1
1 parent 5bc0bcd commit 5370370

File tree

1 file changed

+60
-31
lines changed

1 file changed

+60
-31
lines changed

deps/rabbit/src/rabbit_ff_registry_factory.erl

Lines changed: 60 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -443,37 +443,66 @@ do_initialize_registry(#{feature_flags := AllFeatureFlags,
443443
written_to_disk := WrittenToDisk} = Inventory) ->
444444
%% We log the state of those feature flags.
445445
?LOG_DEBUG(
446-
lists:flatten(
447-
"Feature flags: list of feature flags found:\n" ++
448-
[io_lib:format(
449-
"Feature flags: [~ts] ~ts~n",
450-
[case maps:get(FeatureName, FeatureStates, false) of
451-
true -> "x";
452-
state_changing -> "~";
453-
false -> " "
454-
end,
455-
FeatureName])
456-
|| FeatureName <- lists:sort(maps:keys(AllFeatureFlags)),
457-
?IS_FEATURE_FLAG(maps:get(FeatureName, AllFeatureFlags))] ++
458-
"Feature flags: list of deprecated features found:\n" ++
459-
[io_lib:format(
460-
"Feature flags: [~ts] ~ts~n",
461-
[case maps:get(FeatureName, FeatureStates, false) of
462-
true -> "x";
463-
state_changing -> "~";
464-
false -> " "
465-
end,
466-
FeatureName])
467-
|| FeatureName <- lists:sort(maps:keys(AllFeatureFlags)),
468-
?IS_DEPRECATION(maps:get(FeatureName, AllFeatureFlags))] ++
469-
[io_lib:format(
470-
"Feature flags: scanned applications: ~tp~n"
471-
"Feature flags: feature flag states written to disk: ~ts",
472-
[ScannedApps,
473-
case WrittenToDisk of
474-
true -> "yes";
475-
false -> "no"
476-
end])]),
446+
begin
447+
AllFeatureNames = lists:sort(maps:keys(AllFeatureFlags)),
448+
{FeatureNames,
449+
DeprFeatureNames} = lists:partition(
450+
fun(FeatureName) ->
451+
FeatureProps = maps:get(
452+
FeatureName,
453+
AllFeatureFlags),
454+
?IS_FEATURE_FLAG(FeatureProps)
455+
end, AllFeatureNames),
456+
457+
IsRequired = fun(FeatureName) ->
458+
FeatureProps = maps:get(
459+
FeatureName,
460+
AllFeatureFlags),
461+
required =:=
462+
rabbit_feature_flags:get_stability(
463+
FeatureProps)
464+
end,
465+
{ReqFeatureNames,
466+
NonReqFeatureNames} = lists:partition(IsRequired, FeatureNames),
467+
{ReqDeprFeatureNames,
468+
NonReqDeprFeatureNames} = lists:partition(
469+
IsRequired, DeprFeatureNames),
470+
471+
lists:flatten(
472+
"Feature flags: list of feature flags found:\n" ++
473+
[io_lib:format(
474+
"Feature flags: [~ts] ~ts~n",
475+
[case maps:get(FeatureName, FeatureStates, false) of
476+
true -> "x";
477+
state_changing -> "~";
478+
false -> " "
479+
end,
480+
FeatureName])
481+
|| FeatureName <- NonReqFeatureNames] ++
482+
"Feature flags: list of deprecated features found:\n" ++
483+
[io_lib:format(
484+
"Feature flags: [~ts] ~ts~n",
485+
[case maps:get(FeatureName, FeatureStates, false) of
486+
true -> "x";
487+
state_changing -> "~";
488+
false -> " "
489+
end,
490+
FeatureName])
491+
|| FeatureName <- NonReqDeprFeatureNames] ++
492+
[io_lib:format(
493+
"Feature flags: required feature flags not listed above: ~b~n"
494+
"Feature flags: removed deprecated features not listed "
495+
"above: ~b~n"
496+
"Feature flags: scanned applications: ~0tp~n"
497+
"Feature flags: feature flag states written to disk: ~ts",
498+
[length(ReqFeatureNames),
499+
length(ReqDeprFeatureNames),
500+
ScannedApps,
501+
case WrittenToDisk of
502+
true -> "yes";
503+
false -> "no"
504+
end])])
505+
end,
477506
#{domain => ?RMQLOG_DOMAIN_FEAT_FLAGS}
478507
),
479508

0 commit comments

Comments
 (0)