Class JoiningMetricStream
- java.lang.Object
-
- com.elastisys.autoscaler.metricstreamers.streamjoiner.stream.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.MetricStreamCreates a newJoiningMetricStreamwhich listens to theEventBusfor metric values on theMetricStreams that it has been instructed to observe. Whenever values have been observed on all streams and are not farther apart thanMetricStreamDefinition.getMaxTimeDiff(), the join script is run to produce a newMetricValuethat is sent over theEventBusas aMetricStreamMessage. The client is responsible for calling thestart()method, which causes theJoiningMetricStreamto register with theEventBusand start listening for metrics. When the client is done using theJoiningMetricStreamit should callstop()to ensure that theJoiningMetricStreamunregisters from theEventBusand stops processing events.
-
-
Constructor Summary
Constructors Constructor Description JoiningMetricStream(org.slf4j.Logger logger, com.elastisys.scale.commons.eventbus.EventBus eventBus, JoiningMetricStreamConfig config)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description java.lang.StringgetId()java.lang.StringgetMetric()voidonMetricEvent(com.elastisys.autoscaler.core.monitoring.metricstreamer.api.MetricStreamMessage metricBatch)Called whenever a metric batch is sent on theEventBus.com.elastisys.autoscaler.core.monitoring.metricstreamer.api.query.QueryResultSetquery(org.joda.time.Interval timeInterval, com.elastisys.autoscaler.core.monitoring.metricstreamer.api.query.QueryOptions options)A no-op.voidstart()Register thisJoiningMetricStreamwith theEventBusto start processing metric values.voidstop()UnregisterJoiningMetricStreamfrom theEventBus.
-
-
-
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:
getIdin interfacecom.elastisys.autoscaler.core.monitoring.metricstreamer.api.MetricStream
-
getMetric
public java.lang.String getMetric()
- Specified by:
getMetricin interfacecom.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.MetricStreamExceptionA no-op. TheJoiningMetricStreamdoes not support historical metric queries.- Specified by:
queryin interfacecom.elastisys.autoscaler.core.monitoring.metricstreamer.api.MetricStream- Throws:
com.elastisys.autoscaler.core.monitoring.metricstreamer.api.MetricStreamException
-
start
public void start()
Register thisJoiningMetricStreamwith theEventBusto start processing metric values.
-
stop
public void stop()
UnregisterJoiningMetricStreamfrom theEventBus. From this point on, theJoiningMetricStreamis useless.
-
onMetricEvent
public void onMetricEvent(com.elastisys.autoscaler.core.monitoring.metricstreamer.api.MetricStreamMessage metricBatch)
Called whenever a metric batch is sent on theEventBus.- Parameters:
message-
-
-