View Source AntikytheraCore.Alert.Manager (antikythera v0.5.1)

An event manager hosting multiple AntikytheraCore.Alert.Handlers.

Managers are spawned per OTP application (antikythera and each gear). Each handler has its own buffer to store messages before sending them as an alert.

Summary

Functions

Notify a manager process of a message body with optional time.

Schedule next flushing from handlers. Assuming the interval is in seconds. Note that handlers are kept as state in gen_event manager process, thus calling self/0 always refers to the manager process which the handler is installed in.

Update handler installations according to alert config of an OTP application (antikythera or gear). Handlers will be installed/uninstalled depending on contents of the config. If the config has sufficient information for a handler, it will be installed (noop if already installed). Otherwise, it will not be installed and will be uninstalled if it is already installed.

Functions

Link to this function

notify(manager, body, time \\ Time.now())

View Source
@spec notify(
  atom(),
  String.t(),
  Antikythera.Time.t()
) :: :ok

Notify a manager process of a message body with optional time.

Link to this function

schedule_handler_timeout(handler, interval)

View Source
@spec schedule_handler_timeout(module(), pos_integer()) :: :ok

Schedule next flushing from handlers. Assuming the interval is in seconds. Note that handlers are kept as state in gen_event manager process, thus calling self/0 always refers to the manager process which the handler is installed in.

Link to this function

update_handler_installations(otp_app_name, configs_map)

View Source
@spec update_handler_installations(
  :antikythera | Antikythera.GearName.t(),
  AntikytheraCore.Alert.HandlerConfigsMap.t()
) :: :ok

Update handler installations according to alert config of an OTP application (antikythera or gear). Handlers will be installed/uninstalled depending on contents of the config. If the config has sufficient information for a handler, it will be installed (noop if already installed). Otherwise, it will not be installed and will be uninstalled if it is already installed.

Any errors will be logged but this function always returns :ok.