poa_backend v0.1.0 POABackend.Receivers.System.Stats View Source

This is a Receiver Plugin which is in charge of storing the System Metrics received from the Agents in a Postgres database. If we want to use it we have to declare it in the Config file, inside the :receivers section, ie:

{:store_system_stats, POABackend.Receivers.System.Stats, []}

This Plugin uses Postgres as a backend, specifically the system_stats table. Make sure that table exists before using this Plugin.

We also need to subscribe this plugin to :system_metrics metrics in the config file. For that we have to add this line to the list in the :subscriptions section:

{:store_system_stats, [:system_metrics]}

Link to this section Summary

Functions

This function is called when a Custom Handler detects a client is inactive

In this callback is called when the Receiver process receives an erlang message

A callback executed when the Receiver Plugin starts. The argument is retrieved from the configuration file when the Receiver is defined It must return {:ok, state}, that state will be keept as in GenServer and can be retrieved in the metrics_received/3 function

This callback will be called every time a message to the subscribed metric type arrives. It must return the tuple {:ok, state}

This callback is called just before the Process goes down. This is a good place for closing connections

Link to this section Functions

Link to this function handle_inactive(agent_id, state) View Source

This function is called when a Custom Handler detects a client is inactive.

The Custom Handler must to call explicity to POABackend.CustomHandler.publish_inactive/1 and it will publish the inactive message to all the metrics in the system (defined in the config file).

Callback implementation for POABackend.Receiver.handle_inactive/2.

Link to this function handle_message(message, state) View Source

In this callback is called when the Receiver process receives an erlang message.

It must return {:ok, state}.

Callback implementation for POABackend.Receiver.handle_message/2.

A callback executed when the Receiver Plugin starts. The argument is retrieved from the configuration file when the Receiver is defined It must return {:ok, state}, that state will be keept as in GenServer and can be retrieved in the metrics_received/3 function.

Callback implementation for POABackend.Receiver.init_receiver/1.

Link to this function metrics_received(arg1, from, state) View Source

This callback will be called every time a message to the subscribed metric type arrives. It must return the tuple {:ok, state}

Callback implementation for POABackend.Receiver.metrics_received/3.

This callback is called just before the Process goes down. This is a good place for closing connections.

Callback implementation for POABackend.Receiver.terminate/1.