datalogd.plugins.aggregator_datafilter module

class datalogd.plugins.aggregator_datafilter.AggregatorDataFilter(sinks=[], buffer_size=100, send_every=100, aggregate=['timestamp', 'value'])[source]

Bases: datalogd.DataFilter

Aggregates consecutively received data values into a list and passes the new array(s) on to sinks.

The aggregated data can be sent at different intervals to that which it is received by using the send_every parameter. A value of 1 will send the aggregated data every time new data is received. A value of send_every equal to buffer_size will result in the data being passed on only once the buffer is filled. A typical usage example would be for data which is received once every second, using buffer_size=86400 and send_every=60 to store up to 24 hours of data, and update sinks every minute.

Parameters:
  • buffer_size – Maximum length for lists of aggregated data.
  • send_every – Send data to connected sinks every n updates.
  • aggregate – List of data keys for which the values should be aggregated.
receive(data)[source]

Accept data, aggregate selected values, and pass on aggregated data to any connected sinks.

Parameters:data – Data containing values to aggregate.