-
Notifications
You must be signed in to change notification settings - Fork 25.2k
Clarify autoscaling feature flag registration #54427
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Clarify autoscaling feature flag registration #54427
Conversation
This commit clarifies the autoscaling feature flag registration system property. The intention is that this feature flag is: - unset in snapshot builds - unset, true, or false in release builds - in release builds, unset behaves the same as false - therefore, we only register the enabled flag if the build is a snapshot build, or the build is a release build and the system property is set to true This commit clarifies that intention, and removed a confusion situation where the AUTOSCALING_FEATURE_FLAG_REGISTERED field would be set to false in a snapshot build, even though we were going to register the setting.
Pinging @elastic/es-distributed (:Distributed/Autoscaling) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I left a suggestion.
AUTOSCALING_FEATURE_FLAG_REGISTERED = false; | ||
} else if (property == null) { | ||
AUTOSCALING_FEATURE_FLAG_REGISTERED = null; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I suggest leaving it as a non-nullable boolean
and saying this here.
AUTOSCALING_FEATURE_FLAG_REGISTERED = null; | |
AUTOSCALING_FEATURE_FLAG_REGISTERED = Build.CURRENT.isSnapshot(); |
Then this flag exactly reflects whether the feature flag is registered or not.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There's two issues with that suggestion:
- my intention is that the field is aligned with the value of the system property
es.autoscaling_feature_flag_registered
, it's merely aBoolean
representation of the value of that system property - the intention of using
Autoscaling#isSnapshot
in determining whether or not to register the setting is so that it can be overridden in tests; if we tie whether or not to register the setting directly toBuild#Current#isSnapshot
as you suggest, we lose that ability
@@ -69,7 +71,7 @@ public Autoscaling(final Settings settings) { | |||
*/ | |||
@Override | |||
public List<Setting<?>> getSettings() { | |||
if (isSnapshot() || AUTOSCALING_FEATURE_FLAG_REGISTERED) { | |||
if (isSnapshot() || (AUTOSCALING_FEATURE_FLAG_REGISTERED != null && AUTOSCALING_FEATURE_FLAG_REGISTERED)) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
With my previous suggestion, this simplifies to the following:
if (isSnapshot() || (AUTOSCALING_FEATURE_FLAG_REGISTERED != null && AUTOSCALING_FEATURE_FLAG_REGISTERED)) { | |
if (AUTOSCALING_FEATURE_FLAG_REGISTERED) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Aha, the penny drops. I had not spotted that isSnapshot()
is overridden by tests. It all makes sense now.
LGTM
@elasticmachine update branch |
This commit clarifies the autoscaling feature flag registration system property. The intention is that this system property is: - unset in snapshot builds - unset, true, or false in release builds - in release builds, unset behaves the same as false - therefore, we only register the enabled flag if the build is a snapshot build, or the build is a release build and the system property is set to true This commit clarifies that intention, and removed a confusion situation where the AUTOSCALING_FEATURE_FLAG_REGISTERED field would be set to false in a snapshot build, even though we were going to register the setting.
This commit clarifies the autoscaling feature flag registration system property. The intention is that this system property is:
This commit clarifies that intention, and removed a confusion situation where the AUTOSCALING_FEATURE_FLAG_REGISTERED field would be set to false in a snapshot build, even though we were going to register the setting.
Relates #52088