View Source exometer_proc (exometer_core v1.7.1)

Utility functions for the exometer_proc probe type.

The exometer_proc probe type is a vanilla Erlang process. All messages must be handled explicitly.

The functions in this module can be used by custom types (see e.g. exometer_spiral). When the exometer_proc type is specified explicitly, the process is started automatically, and the following messages:
      lang="erlang"
  {exometer_proc, {update, Value}}
  {exometer_proc, sample}
  {exometer_proc, reset}
  {exometer_proc, {Pid,Ref}, {get_value, Datapoints}} -> {Ref, Reply}
  {exometer_proc, {Pid,Ref}, {setopts, Opts}} -> {Ref, Reply}
  {exometer_proc, stop}

Summary

Functions

Make a synchronous call to an exometer_proc process.

Send an asynchronous message to an exometer_proc process.

Apply process_flag-specific options.

Spawn an exometer_proc process.

Terminate probe process in an orderly way.

Functions

-spec call(pid() | atom(), any()) -> any().

Make a synchronous call to an exometer_proc process.

Note that the receiving process must explicitly handle the message in a receive clause and respond properly. The protocol is:
      lang="erlang"
  call(Pid, Req) ->
      MRef = erlang:monitor(process, Pid),
      Pid ! {exometer_proc, {self(), MRef}, Req},
      receive
          {MRef, Reply} -> Reply
      after 5000 -> error(timeout)
      end.
-spec cast(pid() | atom(), Msg :: any()) -> ok.

Send an asynchronous message to an exometer_proc process.

This function sends a message on the form {exometer_proc, Msg} to the given process.
Link to this function

format_status(Opt, StatusData)

View Source
Link to this function

handle_system_msg(Req, From, State, Cont)

View Source
-spec process_options([{atom(), any()}]) -> ok.
Apply process_flag-specific options.
-spec spawn_process(exometer:name(), fun(() -> no_return())) -> pid().

Spawn an exometer_proc process.

This function sets up appropriate monitoring, and calls the function F which needs to initialize the probe and enter an event loop. (Note: exometer_proc processes are responsible for their own event loop).
Link to this function

spawn_process(Name, F, Opts)

View Source
-spec stop() -> no_return().

Terminate probe process in an orderly way.

This function doesn't return.
Link to this function

system_code_change(IntState, Module, OldVsn, Extra)

View Source
Link to this function

system_continue(Parent, Debug, IntState)

View Source
Link to this function

system_terminate(Reason, Parent, Debug, State)

View Source