poa_backend v0.1.0 POABackend.Receivers.Dashboard View Source

This is a Receiver Plugin which exposes a Websocket server and sends the metrics to the connected clients

This Receiver needs some data to be put in the config file (receivers section), for example:

{:dashboard_receiver, POABackend.Receivers.Dashboard, [
    scheme: :http,
    ws_url: "/ws",
    port: 8181,
    ws_secret: "mywssecret"
    ]}
  • scheme: the scheme type :http or :https
  • ws_url: endpoint for starting websocket connection
  • port: the TCP port where the websocket server will listen
  • ws_secret: the secret string which the clients must put in the “wssecret” header in order to start the connection

All fields are mandatory

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(arg, 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(metrics, 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.