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.
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
Functions
Equivalent to start_link(erlang:group_leader(), 1000, undefined).
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 outputio: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).
-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.
erlperf_monitor:monitor_sample()
for options. Passing undefined
prints all columns known by this version of erlperf
.