extatus v0.2.5 Extatus.Handler View Source
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}
iex> Yggdrasil.subscribe(chan)
iex> flush()
{:Y_EVENT, (...), %Extatus.Message{name: (...), state: :idle}}
Link to this section Summary
Link to this section Types
Link to this section Functions
Returns a specification to start this module under a supervisor.
See Supervisor
.
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(GenServer.name(), term()) :: :ok
Stops a handler
with its name or PID.