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 (*Agent) GetMonitor ¶ added in v1.8.0
GetMonitor returns the pointer to the monitor.
func (*Agent) SendEvent ¶
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.
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
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