Object -
streams
:
Average
Aggregator to calculate average in streams.
Methods
Returns the calculated average after value being aggregated into current average. If the eventType is
streams:CURRENT,value is added to the current sum and count is increase by 1. If the eventType is
streams:EXPIRED, value is subtracted from the current sum and count is descreased by 1. If the eventType
is streams:RESET, Current summation and count is reset, regardless the value. Then by dividing the sum by
count, the average is calculated.
Returns a copy of the Average aggregator without its current state.
Return current state to be saved as a map of any typed values.
Restores the saved state which is passed as a map of any typed values.
Fields
- count int 0
-
description
- sum float 0.0
-
description
Returns the calculated average after value being aggregated into current average. If the eventType is
streams:CURRENT,value is added to the current sum and count is increase by 1. If the eventType is
streams:EXPIRED, value is subtracted from the current sum and count is descreased by 1. If the eventType
is streams:RESET, Current summation and count is reset, regardless the value. Then by dividing the sum by
count, the average is calculated.
Parameters
- value anydata
-
The numeric value being aggregated in order to calculate the new average.
- eventType EventType
-
Type of the incoming event
streams:CURRENT,streams:EXPIREDorstreams:RESET.
-
Return Type
(anydata) Updated average value after
valuebeing aggregated.
Returns a copy of the Average aggregator without its current state.
-
Return Type
(Aggregator) Returns
Averageaggregator.
Return current state to be saved as a map of any typed values.
-
Return Type
(map) A map of
anytyped values.