Async::Service::SupervisorSourceAsyncServiceSupervisorMonitor

class Monitor

Definitions

def to_json(...)

Serialize to JSON string.

Implementation

def to_json(...)
	as_json.to_json(...)
end

def status

Get aggregated utilization status by service name.

Reads utilization data from all registered workers and aggregates it by service name (from supervisor_controller.state[:name]).

Signature

returns Hash

Hash with type and data keys.

Implementation

def status
	{type: self.class.name, data: as_json}
end

def run_once

Run one iteration of the monitor.

Implementation

def run_once
	# This method can be overridden by subclasses to implement specific monitoring logic.
end

def run(parent: Async::Task.current)

Run the utilization monitor.

Periodically aggregates utilization data from all workers.

Signature

returns Async::Task

The task that is running the utilization monitor.

Implementation

def run(parent: Async::Task.current)
	parent.async do
		Loop.periodic(interval: @interval) do
			self.run_once
		end
	end
end