View Source ExTeal.Metric.Trend behaviour (ExTeal v0.28.1)
Trend metrics display the trend of a computed aggregate over a range of time. For example, a trend metric might display the count of new users created every day for the last thirty days.
A Trend metric offers the ability to chose both the range of time that is
being displayed and the granularity of results. The granularity is stored as
as the unit
singluar while the ranges
includes all available units.
The available units are:
- year
- month
- week
- day
- hour
- minute
Some of these data sets will be rather large, so we should provide some safe defaults for the maximum number of results returned.
Summary
Functions
Build a select for the field and aggregate type
Takes a database record transforms it into a two-tuple of the date_result parsed into an appropriate format
Types
@type multi_result() :: map()
@type result() :: map()
@type valid_result() :: result() | [multi_result()]
Callbacks
@callback calculate(ExTeal.Metric.Request.t()) :: valid_result()
@callback precision() :: integer()
@callback twelve_hour_time() :: boolean()
Functions
aggregate(metric, request, query, aggregate_type, field, series_options)
View Source@spec aggregate( module(), ExTeal.Metric.Request.t(), Ecto.Queryable.t(), atom(), atom(), map() ) :: result()
@spec aggregate_as(Ecto.Queryable.t(), atom(), atom()) :: Ecto.Queryable.t()
Build a select for the field and aggregate type
Takes a database record transforms it into a two-tuple of the date_result parsed into an appropriate format
@spec to_local_dt(String.t(), String.t(), String.t()) :: DateTime.t()
@spec to_result_date(DateTime.t()) :: String.t()