extatus v0.2.2 Extatus.Handler

This module defines a handler to monitor processes and check its status.

It tracks the gauge metric :extatus_process_activity. Its meaning is:

  • 0 for a process down.
  • 1 for a process idle.
  • 2 for a process up.

Additionally it has only one label :name which should be unique among processes. :name is the name of the monitored process. See Extatus.Process behaviour and the callback gen_name/1.

By default gathers data every 1000 milliseconds. To change it, for example, to 5000 milliseconds just set the configuration as:

config :extatus,
  timeout: 5000

Other processes can subscribe to an Yggdrasil channel to get the state updates of the process. The channel is:

(...)
iex> chan = %Yggdrasil.Channel{name: :extatus, adapter: Yggdrasil.Elixir}
iex> Yggdrasil.subscribe(chan)
iex> flush()
{:Y_EVENT, (...), %Extatus.Message{name: (...), state: :idle}}

Summary

Functions

Starts a handler with the module and the pid of the process to monitor and some optional GenServer options

Stops a handler with its name or PID

Types

state()
state() :: :starting | :up | :idle | :down

Functions

start_link(module, pid, options \\ [])
start_link(module, pid, GenServer.options) :: GenServer.on_start

Starts a handler with the module and the pid of the process to monitor and some optional GenServer options.

stop(handler, reason \\ :normal)
stop(GenServer.name, term) :: :ok

Stops a handler with its name or PID.