Class JoiningMetricStream

  • All Implemented Interfaces:
    com.elastisys.autoscaler.core.monitoring.metricstreamer.api.MetricStream

    public class JoiningMetricStream
    extends java.lang.Object
    implements com.elastisys.autoscaler.core.monitoring.metricstreamer.api.MetricStream
    Creates a new JoiningMetricStream which listens to the EventBus for metric values on the MetricStreams that it has been instructed to observe. Whenever values have been observed on all streams and are not farther apart than MetricStreamDefinition.getMaxTimeDiff(), the join script is run to produce a new MetricValue that is sent over the EventBus as a MetricStreamMessage.

    The client is responsible for calling the start() method, which causes the JoiningMetricStream to register with the EventBus and start listening for metrics. When the client is done using the JoiningMetricStream it should call stop() to ensure that the JoiningMetricStream unregisters from the EventBus and stops processing events.

    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      java.lang.String getId()  
      java.lang.String getMetric()  
      void onMetricEvent​(com.elastisys.autoscaler.core.monitoring.metricstreamer.api.MetricStreamMessage metricBatch)
      Called whenever a metric batch is sent on the EventBus.
      com.elastisys.autoscaler.core.monitoring.metricstreamer.api.query.QueryResultSet query​(org.joda.time.Interval timeInterval, com.elastisys.autoscaler.core.monitoring.metricstreamer.api.query.QueryOptions options)
      A no-op.
      void start()
      Register this JoiningMetricStream with the EventBus to start processing metric values.
      void stop()
      Unregister JoiningMetricStream from the EventBus.
      • Methods inherited from class java.lang.Object

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

      • JoiningMetricStream

        public JoiningMetricStream​(org.slf4j.Logger logger,
                                   com.elastisys.scale.commons.eventbus.EventBus eventBus,
                                   JoiningMetricStreamConfig config)
    • Method Detail

      • getId

        public java.lang.String getId()
        Specified by:
        getId in interface com.elastisys.autoscaler.core.monitoring.metricstreamer.api.MetricStream
      • getMetric

        public java.lang.String getMetric()
        Specified by:
        getMetric in interface com.elastisys.autoscaler.core.monitoring.metricstreamer.api.MetricStream
      • query

        public com.elastisys.autoscaler.core.monitoring.metricstreamer.api.query.QueryResultSet query​(org.joda.time.Interval timeInterval,
                                                                                                      com.elastisys.autoscaler.core.monitoring.metricstreamer.api.query.QueryOptions options)
                                                                                               throws com.elastisys.autoscaler.core.monitoring.metricstreamer.api.MetricStreamException
        A no-op. The JoiningMetricStream does not support historical metric queries.
        Specified by:
        query in interface com.elastisys.autoscaler.core.monitoring.metricstreamer.api.MetricStream
        Throws:
        com.elastisys.autoscaler.core.monitoring.metricstreamer.api.MetricStreamException
      • start

        public void start()
        Register this JoiningMetricStream with the EventBus to start processing metric values.
      • onMetricEvent

        public void onMetricEvent​(com.elastisys.autoscaler.core.monitoring.metricstreamer.api.MetricStreamMessage metricBatch)
        Called whenever a metric batch is sent on the EventBus.
        Parameters:
        message -