public class YamlRollingTimeWindowMeanEnricher<T extends java.lang.Number> extends AbstractTransformer<T,java.lang.Double>
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
Modifier and Type | Class and Description |
---|---|
static class |
YamlRollingTimeWindowMeanEnricher.ConfidenceQualifiedNumber |
AbstractEntityAdjunct.AdjunctTagSupport
BrooklynObject.TagSupport
Configurable.ConfigurationSupport
BrooklynObjectInternal.ConfigurationSupportInternal
Modifier and Type | Field and Description |
---|---|
static ConfigKey<java.lang.Double> |
CONFIDENCE_REQUIRED_TO_PUBLISH |
static ConfigKey<Duration> |
WINDOW_DURATION |
PRODUCER, SOURCE_SENSOR, TARGET_SENSOR
SUPPRESS_DUPLICATES
NOOP
Constructor and Description |
---|
YamlRollingTimeWindowMeanEnricher() |
Modifier and Type | Method and Description |
---|---|
YamlRollingTimeWindowMeanEnricher.ConfidenceQualifiedNumber |
getAverage(long fromTime,
long graceAllowed) |
onEvent, setEntity
getEnricherType, getRebindSupport
config, configure, destroy, getAllConfig, getConfig, getConfigMap, getDisplayName, getName, getUniqueTag, isDestroyed, isRunning, setConfig, setDisplayName, setName, tags, toString
getCatalogItemId, getId, getManagementContext, getTagSupport, init, rebind, setCatalogItemId, setManagementContext
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
getAllConfig, getConfig, getId, getName, setConfig
getUniqueTag, isDestroyed, isRunning
getCatalogItemId, getDisplayName, getTagSupport, tags
config
setCatalogItemId
public static ConfigKey<java.lang.Double> CONFIDENCE_REQUIRED_TO_PUBLISH
public YamlRollingTimeWindowMeanEnricher.ConfidenceQualifiedNumber getAverage(long fromTime, long graceAllowed)