Beaker.TimeSeries.Aggregated

Beaker.TimeSeries.Aggregated is the datastore for aggregated time series data. It’s purposed mostly for internal use only.

The only two functions that developers should use are get/1 and all/0 in order to get aggregated time series data out.

Summary

Retrieves all aggregated time series in the form of a HashDict

Get the aggregated time series data for the given key

Functions

all()

Retrieves all aggregated time series in the form of a HashDict.

Examples

iex> Beaker.TimeSeries.Aggregated.clear :ok iex> Beaker.TimeSeries.Aggregated.insert(“all_series1”, {1, 2}) :ok iex> Beaker.TimeSeries.Aggregated.insert(“all_series2”, {3, 4}) :ok iex> Beaker.TimeSeries.Aggregated.all |> Enum.into(%{}) %{“all_series1” => [{1, 2}], “all_series2” => [{3, 4}]}

Returns time_series where time_series is a HashDict of all the aggregated time series currently existing. Each time series is returned as a list of pairs. Each pair is a timestamp in epoch (aggregated to the nearest aggregation interval) and the value recorded. Each list is guaranteed to be in reverse chronological ordering, that is, the latest aggregated interval will be the first in the list.

get(key)

Get the aggregated time series data for the given key.

Parameters

  • key: The name of the aggregated time_series to retrieve.

Examples

iex> Beaker.TimeSeries.Aggregated.get(“get_series”) nil iex> Beaker.TimeSeries.Aggregated.insert(“get_series”, {1, 2}) :ok iex> Beaker.TimeSeries.Aggregated.get(“get_series”) [{1, 2}]

Returns time_series where time_series is a list of the data entries aggregated for the given key.