View Source erlperf_cluster_monitor (erlperf v2.2.0)

Logs monitoring events for the entire cluster, to file or device. Requires erlperf_history service running, fails otherwise. Uses completely different to erlperf_monitor approach; instead of waiting for new samples to come, cluster monitor just outputs existing samples periodically.

Example primary node:
       rebar3 shell --sname primary
       (primary@ubuntu22)1> erlperf_history:start_link().
       {ok,<0.211.0>}
       (primary@ubuntu22)2> erlperf_cluster_monitor:start_link().
       {ok,<0.216.0>}
Example benchmarking node:
       rebar3 shell --sname bench1
       (bench1@ubuntu22)1> net_kernel:connect_node('primary@ubuntu22').
       true
       (bench1@ubuntu22)2> erlperf:run(rand, uniform, []).
As soon as the new benchmarking jon on the node bench is started, it is reported in the cluster monitoring output.

Link to this section Summary

Types

Specifies monitoring output device.

Functions

Starts cluster-wide monitor process, and links it to the caller.

Link to this section Types

-type handler() :: {module(), atom(), term()} | file:filename_all() | {fd, io:device()} | io:device().

Specifies monitoring output device.

It could be an output io:device() (such as erlang:group_leader/0, user or standard_error), a file name, or a {Module, Function, UserState} tuple. In the latter case, instead of printing, cluster monitor calls the specified function, which must have arity of 2, accepting filtered erlperf_monitor:monitor_sample() as the first argument, and Userstate as the second, returning next UserState.

Link to this section Functions

-spec start_link() -> {ok, Pid :: pid()} | {error, Reason :: term()}.

Equivalent to start_link(erlang:group_leader(), 1000, undefined).

Link to this function

start_link(Handler, IntervalMs, Fields)

View Source
-spec start_link(Handler :: handler(), IntervalMs :: pos_integer(), Fields :: [atom()] | undefined) ->
              {ok, Pid :: pid()} | {error, Reason :: term()}.

Starts cluster-wide monitor process, and links it to the caller.

Intended to be used in a supervisor ChildSpec, making the process a part of the supervision tree.

IntervalMs specifies time, in milliseconds, between output handler invocations.

Fields specifies the list of field names to report, and the order in which columns are printed. see erlperf_monitor:monitor_sample() for options. Passing undefined prints all columns known by this version of erlperf.