IO::MetricsSourceIOMetricsListener

class Listener

Represents a network listener socket with its queue statistics.

Nested

Definitions

def as_json(*)

Serialize for JSON; address uses Addrinfo#inspect_sockaddr.

Implementation

def as_json(*)
	{
		address: address&.inspect_sockaddr,
		queued_count: queued_count,
		active_count: active_count,
		close_wait_count: close_wait_count,
	}
end

def to_json(*arguments)

Convert the object to a JSON string.

Implementation

def to_json(*arguments)
	as_json.to_json(*arguments)
end

def self.zero

Create a zero-initialized Listener instance (no endpoint; for tests or templates).

Signature

returns Listener

Counters zero; #address is nil.

Implementation

def self.zero
	new(nil, 0, 0, 0)  # address, queued_count, active_count, close_wait_count
end

def self.supported?

Whether listener stats can be captured on this system.

Implementation

def self.supported?
	false
end

def self.capture(**options)

Capture listener stats for the given address(es).

Signature

parameter addresses Array(String) | Nil

TCP address(es) to capture, e.g. ["0.0.0.0:80"]. If nil, captures all listening TCP sockets.

parameter paths Array(String) | Nil

Unix socket path(s) to capture. If nil and addresses is nil, captures all. If nil but addresses specified, captures none.

returns Array(Listener) | Nil

Captured listeners, or nil if not supported.

Implementation

def self.capture(**options)
	return nil
end