signal

package
v1.15.4 Latest Latest
Warning

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

Go to latest
Published: Apr 11, 2024 License: Apache-2.0 Imports: 16 Imported by: 3

Documentation

Overview

Package signal provides handling notifications from perf RB signal map.

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrFullChannel         = errors.New("full channel")
	ErrNilChannel          = errors.New("nil channel")
	ErrRuntimeRegistration = errors.New("runtime registration not supported")
	ErrNoHandlers          = errors.New("no registered signal handlers")
)
View Source
var Cell = cell.Module(
	"signal",
	"Receive signals from datapath and distribute them to registered channels",

	cell.Provide(provideSignalManager),
)

Cell initializes and manages the signal manager.

Functions

This section is empty.

Types

type SignalHandler

type SignalHandler func(io.Reader) (metricData string, err error)

SignalHandler parses signal data from the perf message via a reader. Signal handler functions are only ever called from a single goroutine. A nil reader is passed when the handler is closed. Returns low-cardinality representation of the signal data to be used in a metric.

func ChannelHandler

func ChannelHandler[T fmt.Stringer](ch chan<- T) SignalHandler

ChannelHandler is a generic function returning a SignalHandler that writes data from a reader to the channel.

type SignalManager

type SignalManager interface {
	// RegisterHandler must be called during initialization of the cells using signals.
	RegisterHandler(handler SignalHandler, signals ...SignalType) error

	MuteSignals(signals ...SignalType) error
	UnmuteSignals(signals ...SignalType) error
}

type SignalType

type SignalType uint32
const (
	// SignalNatFillUp denotes potential congestion on the NAT table
	SignalNatFillUp SignalType = iota
	// SignalCTFillUp denotes potential congestion on the CT table
	SignalCTFillUp
	// SignalAuthRequired denotes a connection dropped due to missing authentication
	SignalAuthRequired
	SignalTypeMax
)

Jump to

Keyboard shortcuts

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