Class RuleBasedPredictor
- java.lang.Object
-
- com.elastisys.autoscaler.core.prediction.impl.standard.predictor.AbstractPredictor
-
- com.elastisys.autoscaler.predictors.rulebased.RuleBasedPredictor
-
- All Implemented Interfaces:
com.elastisys.autoscaler.core.api.Configurable<com.elastisys.autoscaler.core.prediction.impl.standard.config.PredictorConfig>,com.elastisys.autoscaler.core.api.Service<com.elastisys.autoscaler.core.prediction.impl.standard.config.PredictorConfig>,com.elastisys.autoscaler.core.prediction.impl.standard.api.Predictor
public class RuleBasedPredictor extends com.elastisys.autoscaler.core.prediction.impl.standard.predictor.AbstractPredictorA compute unit predictor that suggests capacity changes from a collection ofScalingRules, defining thresholds for the monitored metric and what scaling actions to take when those thresholds are breached. When a threshold has been exceeded (for a sufficiently long time), causing aScalingRuleto fire, theRuleBasedPredictorwill enter a "cool-down period" in order for the scaling decision to get some time to take effect. During this cool-down period, no newScalingRules will be allowed to fire, and theRuleBasedPredictorwill just respond with its latest "prediction". Since theRuleBasedPredictormerely reacts to numerical changes in the monitored metric, it makes no particular assumptions on the unit of the observed metric values. TheRuleBasedPredictordoes not need to be aware of what the metric represents, it works the same regardless of if it monitors a stream of observed response times or a stream of CPU utilization pool average values.- See Also:
ScalingRule
-
-
Constructor Summary
Constructors Constructor Description RuleBasedPredictor(org.slf4j.Logger logger, com.elastisys.scale.commons.eventbus.EventBus eventBus, com.elastisys.autoscaler.core.monitoring.api.MonitoringSubsystem monitoringSubsystem)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidapplyConfig(com.elastisys.autoscaler.core.prediction.impl.standard.config.PredictorConfig newConfig)java.util.Optional<com.elastisys.autoscaler.core.prediction.api.types.Prediction>doPrediction(java.util.Optional<com.elastisys.scale.cloudpool.api.types.PoolSizeSummary> poolSize, org.joda.time.DateTime predictionTime)voidonStart(com.elastisys.autoscaler.core.monitoring.metricstreamer.reader.MetricStreamReader metricReader)voidonStop()voidvalidateConfig(com.elastisys.autoscaler.core.prediction.impl.standard.config.PredictorConfig configuration)
-
-
-
Method Detail
-
validateConfig
public void validateConfig(com.elastisys.autoscaler.core.prediction.impl.standard.config.PredictorConfig configuration) throws java.lang.IllegalArgumentException- Specified by:
validateConfigin classcom.elastisys.autoscaler.core.prediction.impl.standard.predictor.AbstractPredictor- Throws:
java.lang.IllegalArgumentException
-
applyConfig
public void applyConfig(com.elastisys.autoscaler.core.prediction.impl.standard.config.PredictorConfig newConfig) throws java.lang.IllegalArgumentException- Specified by:
applyConfigin classcom.elastisys.autoscaler.core.prediction.impl.standard.predictor.AbstractPredictor- Throws:
java.lang.IllegalArgumentException
-
onStart
public void onStart(com.elastisys.autoscaler.core.monitoring.metricstreamer.reader.MetricStreamReader metricReader)
- Specified by:
onStartin classcom.elastisys.autoscaler.core.prediction.impl.standard.predictor.AbstractPredictor
-
onStop
public void onStop()
- Specified by:
onStopin classcom.elastisys.autoscaler.core.prediction.impl.standard.predictor.AbstractPredictor
-
doPrediction
public java.util.Optional<com.elastisys.autoscaler.core.prediction.api.types.Prediction> doPrediction(java.util.Optional<com.elastisys.scale.cloudpool.api.types.PoolSizeSummary> poolSize, org.joda.time.DateTime predictionTime) throws com.elastisys.autoscaler.core.prediction.api.PredictionException- Specified by:
doPredictionin classcom.elastisys.autoscaler.core.prediction.impl.standard.predictor.AbstractPredictor- Throws:
com.elastisys.autoscaler.core.prediction.api.PredictionException
-
-