View Source Mobius (mobius v0.6.1)

Localized metrics reporter

Summary

Types

Arguments to Mobius

A function to process an event's measurements

Options you can pass an event

The name of the Mobius instance

A single metric data point

The name of the metric

Functions

Returns a specification to start this module under a supervisor.

Get the current metric information

Persist the metrics to disk

Start Mobius

Types

@type arg() ::
  {:mobius_instance, instance()}
  | {:metrics, [Telemetry.Metrics.t()]}
  | {:persistence_dir, binary()}
  | {:database, Mobius.RRD.t()}
  | {:events, [event_def()]}
  | {:event_log_size, integer()}
  | {:clock, module()}
  | {:session, session()}

Arguments to Mobius

  • :name - the name of the mobius instance (defaults to :mobius)
  • :metrics - list of telemetry metrics for Mobius to track
  • :persistence_dir - the top level directory where mobius will persist
  • :autosave_interval - time in seconds between automatic writes of the persistence data (default disabled) metric information
  • :database - the Mobius.RRD.t() to use. This will default to the default values found in Mobius.RRD
  • :events - a list of events for mobius to store in the event log
  • :event_log_size - number of events to store (defaults to 500)
  • :clock - module that implements the Mobius.Clock behaviour
  • :session - a unique id to distinguish between different ties Mobius has ran

Mobius sessions allow you collect events to analyze across the different times mobius ran. A good example of this might be measuring how fast an interface makes its first connection. You can build averages over run times and measure connection performance. This will allow you to know on average how fast a device connects so you can check for increased or decreased performance between runs.

By default Mobius will generate an UUID for each run.

@type event_def() :: [binary() | {binary(), keyword()}]
Link to this type

event_measurement_values()

View Source
@type event_measurement_values() :: ({atom(), term()} -> term())

A function to process an event's measurements

This will be called on each measurement and will receive a tuple where the first element is the name of the measurement and the second element is the value. This function can process the value and return a new one.

@type event_opt() ::
  {:measurement_values, event_measurement_values()}
  | {:tags, [atom()]}
  | {:group, atom()}

Options you can pass an event

These options only apply to the :event argument to Mobius. If you want to track metrics please see the :metrics argument to Mobius.

  • :tags - list of tag names to save with the event
  • :measurement_values - a function that will receive each measurement that allows for data processing before storing the event in the event log
  • :group - an atom that defines the event group, this will allow for filtering on particular types of events for example: :network. Default is :default
@type instance() :: atom()

The name of the Mobius instance

This is used to store data for a particular set of mobius metrics.

@type metric() :: %{
  type: metric_type(),
  value: term(),
  tags: map(),
  timestamp: integer(),
  name: binary()
}

A single metric data point

  • :type - the type of the metric
  • :value - the value of the measurement for the metric
  • :tags - a map of the tags for the metric
  • :timestamp - the naive time in seconds the metric was sampled
  • :name - the name of the metric
@type metric_name() :: binary()

The name of the metric

Example: "vm.memory.total"

@type metric_type() :: :counter | :last_value | :sum | :summary
@type session() :: binary()
@type time_unit() :: :second | :minute | :hour | :day
@type timestamp() :: integer()

Functions

Returns a specification to start this module under a supervisor.

See Supervisor.

Link to this function

get_latest_events(instance \\ :mobius)

View Source
@spec get_latest_events(instance()) :: [Mobius.Event.t()]

Get the latest events

The latest events are the events recorded between the last query for the events and the query for the events that is being called.

Link to this function

get_latest_metrics(instance \\ :mobius)

View Source
@spec get_latest_metrics(instance()) :: [metric()]

Get the latest metrics

The latest metrics are the metrics recorded between the last query for the metrics and the query for the metrics that is being called.

Get the current metric information

If you configured Mobius to use a different name then you can pass in your custom name to ensure Mobius requests the metrics from the right place.

@spec info(instance() | nil) :: :ok

Persist the metrics to disk

@spec save(instance()) :: :ok | {:error, reason :: term()}

Start Mobius