ExTeal.Metric.Value behaviour (ExTeal v0.21.0) View Source

Value Metrics display a single value and it's change compared to a previous interval of time. For example, a value metric might display the total number of blog posts created in the last thirty days, versus the previous thirty days.

Once generated, a value metric module has two functions that can be customized, a calculate/1 and a ranges/0 function.

Additionally there are modifier functions that change the behavior and display of the metric.

Link to this section Summary

Link to this section Types

Specs

multi_result() :: [%{label: String.t(), data: result()}]

Specs

result() :: %{current: term(), previous: term()}

Specs

valid_result() :: result() | [multi_result()]

Link to this section Callbacks

Link to this section Functions

Link to this function

aggregate(metric_module, request, queryable, aggregate_type, field)

View Source

Specs

aggregate(
  module(),
  ExTeal.Metric.Request.t(),
  Ecto.Queryable.t(),
  atom(),
  atom()
) :: map()
Link to this function

between_current(query, atom, options)

View Source
Link to this function

query_for(current, metric, request, queryable, aggregate_type, field)

View Source

Specs

query_for(
  atom(),
  module(),
  ExTeal.Metric.Request.t(),
  Ecto.Queryable.t(),
  atom(),
  atom()
) ::
  integer() | float()