Class ReactivePredictor

  • 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 ReactivePredictor
    extends com.elastisys.autoscaler.core.prediction.impl.standard.predictor.AbstractPredictor
    A naive Predictor that simply uses the latest observed metric value as the predicted future value (using a "tomorrow will probably be very similar to today"-style heuristic) combined with adding some optional safety margin to try and stay "above the load curve".

    To keep some margin to the load curve a safetyMargin can optionally be set in the ReactivePredictorParams, which will add some extra padding to every prediction

    If metric values are sparse, a sufficiently long lookbackWindow should be specified so that the predictor can initialize on start-up.

    • Field Summary

      • Fields inherited from class com.elastisys.autoscaler.core.prediction.impl.standard.predictor.AbstractPredictor

        logger
    • Constructor Summary

      Constructors 
      Constructor Description
      ReactivePredictor​(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
      void applyConfig​(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)  
      void onStart​(com.elastisys.autoscaler.core.monitoring.metricstreamer.reader.MetricStreamReader metricReader)  
      void onStop()  
      void validateConfig​(com.elastisys.autoscaler.core.prediction.impl.standard.config.PredictorConfig configuration)  
      • Methods inherited from class com.elastisys.autoscaler.core.prediction.impl.standard.predictor.AbstractPredictor

        configure, getConfiguration, getConfigurationClass, getEventBus, getStatus, isConfigured, isStarted, predict, start, stop, validate
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • ReactivePredictor

        @Inject
        public ReactivePredictor​(org.slf4j.Logger logger,
                                 com.elastisys.scale.commons.eventbus.EventBus eventBus,
                                 com.elastisys.autoscaler.core.monitoring.api.MonitoringSubsystem monitoringSubsystem)
    • Method Detail

      • validateConfig

        public void validateConfig​(com.elastisys.autoscaler.core.prediction.impl.standard.config.PredictorConfig configuration)
                            throws java.lang.IllegalArgumentException
        Specified by:
        validateConfig in class com.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:
        applyConfig in class com.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:
        onStart in class com.elastisys.autoscaler.core.prediction.impl.standard.predictor.AbstractPredictor
      • onStop

        public void onStop()
        Specified by:
        onStop in class com.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:
        doPrediction in class com.elastisys.autoscaler.core.prediction.impl.standard.predictor.AbstractPredictor
        Throws:
        com.elastisys.autoscaler.core.prediction.api.PredictionException