-
Notifications
You must be signed in to change notification settings - Fork 474
Plugin for custom evaluator for scaling metric evaluation #953
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
base: main
Are you sure you want to change the base?
Changes from all commits
89f7857
d1cbb11
7aa4185
7a57e05
67d0799
e9c055b
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -21,6 +21,8 @@ | |
import org.apache.flink.autoscaler.metrics.MetricAggregator; | ||
import org.apache.flink.configuration.ConfigOption; | ||
import org.apache.flink.configuration.ConfigOptions; | ||
import org.apache.flink.configuration.Configuration; | ||
import org.apache.flink.configuration.DelegatingConfiguration; | ||
import org.apache.flink.configuration.MemorySize; | ||
|
||
import java.time.Duration; | ||
|
@@ -31,6 +33,7 @@ public class AutoScalerOptions { | |
|
||
public static final String OLD_K8S_OP_CONF_PREFIX = "kubernetes.operator."; | ||
public static final String AUTOSCALER_CONF_PREFIX = "job.autoscaler."; | ||
public static final String CUSTOM_EVALUATOR_CONF_PREFIX = "metrics.custom-evaluator."; | ||
|
||
private static String oldOperatorConfigKey(String key) { | ||
return OLD_K8S_OP_CONF_PREFIX + AUTOSCALER_CONF_PREFIX + key; | ||
|
@@ -418,4 +421,19 @@ private static ConfigOptions.OptionBuilder autoScalerConfig(String key) { | |
"Minimum allowed value for the observed scalability coefficient. " | ||
+ "Prevents aggressive scaling by clamping low coefficient estimates. " | ||
+ "If the estimated coefficient falls below this value, it is capped at the configured minimum."); | ||
|
||
public static final ConfigOption<String> CUSTOM_EVALUATOR_NAME = | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. How about deriving the name from the CustomEvaluator interface? We can load all the names when we load the custom evaluator implementations. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Thanks so much for your inputs! That Sounds perfect! Will make the update! |
||
autoScalerConfig(CUSTOM_EVALUATOR_CONF_PREFIX + "name") | ||
.stringType() | ||
.defaultValue(null) | ||
.withFallbackKeys(oldOperatorConfigKey(CUSTOM_EVALUATOR_CONF_PREFIX + "name")) | ||
.withDescription("Name of the custom evaluator to be used."); | ||
|
||
public static Configuration forCustomEvaluator( | ||
Configuration configuration, String customEvaluatorName) { | ||
// add support for fallBackKey with DelegatingConfiguration. | ||
return new DelegatingConfiguration( | ||
configuration, | ||
AUTOSCALER_CONF_PREFIX + CUSTOM_EVALUATOR_CONF_PREFIX + customEvaluatorName + "."); | ||
} | ||
} |
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.
Let's add a paragraph here and in the non Chinese docs.