Brooklyn

brooklyn.enricher
[Java] Class RollingTimeWindowMeanEnricher

java.lang.Object
  brooklyn.policy.basic.AbstractEntityAdjunct
      brooklyn.enricher.basic.AbstractEnricher
          brooklyn.enricher.basic.AbstractTypeTransformingEnricher
              brooklyn.enricher.RollingTimeWindowMeanEnricher

public class RollingTimeWindowMeanEnricher
extends AbstractTypeTransformingEnricher

Transforms Sensor data into a rolling average based on a time window. All values within the window are weighted or discarded based on the timestamps associated with them (discards occur when a new value is added or an average is requested)

This will not extrapolate figures - it is assumed a value is valid and correct for the entire time period between it and the previous value. Normally, the average attribute is only updated when a new value arrives so it can give a fully informed average, but there is a danger of this going stale.

When an average is requested, it is likely there will be a segment of the window for which there isn't a value. Instead of extrapolating a value and providing different extrapolation techniques, the average is reported with a confidence value which reflects the fraction of the time window for which the values were valid.

Consumers of the average may ignore the confidence value and just use the last known average. They could multiply the returned value by the confidence value to get a decay-type behavior as the window empties. A third alternative is to, at a certain confidence threshold, report that the average is no longer meaningful.

The default average when no data has been received is 0, with a confidence of 0


Nested Class Summary
static class RollingTimeWindowMeanEnricher.ConfidenceQualifiedNumber

 
Field Summary
 
Fields inherited from class AbstractTypeTransformingEnricher
target
 
Fields inherited from class AbstractEnricher
leftoverProperties
 
Fields inherited from class AbstractEntityAdjunct
_subscriptionTracker, entity, id, name
 
Method Summary
java.lang.Object RollingTimeWindowMeanEnricher(Entity producer, AttributeSensor source, AttributeSensor target, long timePeriod)

RollingTimeWindowMeanEnricher.ConfidenceQualifiedNumber getAverage()

RollingTimeWindowMeanEnricher.ConfidenceQualifiedNumber getAverage(long now)

void onEvent(SensorEvent event)

void onEvent(SensorEvent event, long eventTime)

 
Methods inherited from class AbstractTypeTransformingEnricher
setEntity
 
Methods inherited from class AbstractEnricher
configure
 
Methods inherited from class AbstractEntityAdjunct
check, destroy, getAllSubscriptions, getId, getManagementContext, getName, getSubscriptionTracker, isDestroyed, isRunning, setEntity, setId, setName, subscribe, subscribeToChildren, subscribeToMembers, unsubscribe, unsubscribe
 

Method Detail

RollingTimeWindowMeanEnricher

public java.lang.Object RollingTimeWindowMeanEnricher(Entity producer, AttributeSensor source, AttributeSensor target, long timePeriod)


getAverage

public RollingTimeWindowMeanEnricher.ConfidenceQualifiedNumber getAverage()


getAverage

public RollingTimeWindowMeanEnricher.ConfidenceQualifiedNumber getAverage(long now)


onEvent

@Override
public void onEvent(SensorEvent event)


onEvent

public void onEvent(SensorEvent event, long eventTime)


 

Brooklyn Multi-Cloud Application Management Platform
brooklyncentral.github.com. Apache License. © 2012.