agent

package
v1.8.2 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jul 23, 2020 License: Apache-2.0 Imports: 22 Imported by: 4

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Agent

type Agent struct {
	// contains filtered or unexported fields
}

Agent represents an instance of a monitor agent. It runs a monitor to read events from the BPF perf ring buffer and provides an interface to also pass in non-BPF events.

func NewAgent added in v1.6.0

func NewAgent(ctx context.Context, npages int) (a *Agent, err error)

NewAgent creates a new monitor agent

func (*Agent) GetMonitor added in v1.8.0

func (a *Agent) GetMonitor() *Monitor

GetMonitor returns the pointer to the monitor.

func (*Agent) SendEvent

func (a *Agent) SendEvent(typ int, event interface{}) error

SendEvent sends an event to the node monitor which will then distribute to all monitor listeners

func (*Agent) State

func (a *Agent) State() *models.MonitorStatus

State returns the monitor status.

func (*Agent) Stop added in v1.6.0

func (a *Agent) Stop()

Stop stops the monitor agent

type Monitor added in v1.6.0

type Monitor struct {
	lock.Mutex
	models.MonitorStatus
	// contains filtered or unexported fields
}

Monitor structure for centralizing the responsibilities of the main events reader. There is some racey-ness around perfReaderCancel since it replaces on every perf reader start. In the event that a MonitorListener from a previous generation calls its cleanup after the start of the new perf reader, we might call the new, and incorrect, cancel function. We guard for this by checking the number of listeners during the cleanup call. The perf reader must have at least one MonitorListener (since it started) so no cancel is called. If it doesn't, the cancel is the correct behavior (the older generation cancel must have been called for us to get this far anyway).

func NewMonitor added in v1.6.0

func NewMonitor(ctx context.Context, nPages int, server1_2 net.Listener) (m *Monitor, err error)

NewMonitor creates a Monitor, and starts client connection handling and agent event handling. Note that the perf buffer reader is started only when listeners are connected.

func (*Monitor) RegisterNewListener added in v1.8.0

func (m *Monitor) RegisterNewListener(parentCtx context.Context, newListener listener.MonitorListener)

RegisterNewListener adds the new MonitorListener to the global list. It also spawns a singleton goroutine to read and distribute the events. It passes a cancelable context to this goroutine and the cancelFunc is assigned to perfReaderCancel. Note that cancelling parentCtx (e.g. on program shutdown) will also cancel the derived context.

func (*Monitor) Status added in v1.6.0

func (m *Monitor) Status() *models.MonitorStatus

Status returns the current status of the monitor

Directories

Path Synopsis

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL