Instruments.Sysmon.Reporter (Instruments v2.12.0)

Copy Markdown

Since only one process can subscribe to system monitor events, the Reporter acts as a relay for system monitor events, allowing multiple subscribers to receive system monitor events.

On startup, the Reporter will subscribe to the system monitor events configured in :sysmon_events in the :instruments application environment. If no events are configured, the Reporter will not subscribe to any events.

Summary

Functions

Returns a specification to start this module under a supervisor.

Returns the system monitor events the Reporter is subscribed to.

Sets the system monitor events to subscribe to. If no events are provided, the Reporter will not register itself as the system monitor process.

Subscribes the provided pid to configured system monitor events.

Unsubscribes the provided pid from system monitor events.

Types

sysmon_event()

@type sysmon_event() ::
  {:long_gc, pos_integer()}
  | {:long_schedule, pos_integer()}
  | {:large_heap, pos_integer()}
  | :busy_port
  | :busy_dist_port

t()

@type t() :: %Instruments.Sysmon.Reporter{
  events: [sysmon_event()],
  subscribers: %{required(reference()) => pid()}
}

Functions

child_spec(init_arg)

Returns a specification to start this module under a supervisor.

See Supervisor.

get_events()

@spec get_events() :: [sysmon_event()]

Returns the system monitor events the Reporter is subscribed to.

set_events(events)

@spec set_events([sysmon_event()]) :: :ok

Sets the system monitor events to subscribe to. If no events are provided, the Reporter will not register itself as the system monitor process.

start_link(opts \\ [])

subscribe(pid \\ self())

@spec subscribe(pid()) :: :ok

Subscribes the provided pid to configured system monitor events.

unsubscribe(pid \\ self())

@spec unsubscribe(pid()) :: :ok

Unsubscribes the provided pid from system monitor events.