ExTeal.Metric.Trend behaviour (ExTeal v0.21.0) View Source
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.
Link to this section 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
Link to this section Types
Specs
multi_result() :: map()
Specs
result() :: map()
Specs
valid_result() :: result() | [multi_result()]
Link to this section Callbacks
Specs
calculate(ExTeal.Metric.Request.t()) :: valid_result()
Specs
Specs
precision() :: integer()
Specs
twelve_hour_time() :: boolean()
Link to this section Functions
aggregate(metric, request, query, aggregate_type, field, series_options)
View SourceSpecs
aggregate( module(), ExTeal.Metric.Request.t(), Ecto.Queryable.t(), atom(), atom(), map() ) :: result()
Specs
aggregate_as(Ecto.Queryable.t(), atom(), atom()) :: Ecto.Queryable.t()
Build a select for the field and aggregate type
Specs
Takes a database record transforms it into a two-tuple of the date_result parsed into an appropriate format
Specs
to_local_dt(String.t(), String.t(), String.t()) :: DateTime.t()
Specs
to_result_date(DateTime.t()) :: String.t()