Documentation ¶
Index ¶
- Variables
- func AllListeners(msg notify.Message)
- func DockerRun(t *testing.T, args ...string) (containerId string)
- func ExecWGCurl(readyWG *sync.WaitGroup, retries uint, args ...string) error
- func GetDefaultSensorsWithFile(t *testing.T, ctx context.Context, file, lib string) ([]*sensors.Sensor, error)
- func GetMyPid() uint32
- func LoopEvents(ctx context.Context, t *testing.T, doneWG, readyWG *sync.WaitGroup, ...)
- func RegisterEventHandlerAtInit(ev uint8, handler func(r *bytes.Reader) ([]Event, error))
- func RemovePrograms(bpfDir, mapDir string)
- func WaitForProcess(process string) error
- func WriteConfigFile(fileName, config string) error
- type Channel
- type Event
- type Listener
- type Observer
- func GetDefaultObserver(t *testing.T, ctx context.Context, lib string) (*Observer, error)
- func GetDefaultObserverWithBase(t *testing.T, ctx context.Context, b *sensors.Sensor, file, lib string) (*Observer, error)
- func GetDefaultObserverWithFile(t *testing.T, ctx context.Context, file, lib string) (*Observer, error)
- func GetDefaultObserverWithFileNoTest(t *testing.T, ctx context.Context, file, lib string, fail bool) (*Observer, error)
- func GetDefaultObserverWithLib(t *testing.T, ctx context.Context, config, lib string) (*Observer, error)
- func GetDefaultObserverWithWatchers(t *testing.T, ctx context.Context, base *sensors.Sensor, opts ...TestOption) (*Observer, error)
- func NewObserver(configFile string) *Observer
- func (k *Observer) AddListener(listener Listener)
- func (k *Observer) InitSensorManager() error
- func (k *Observer) PrintStats()
- func (k *Observer) Remove()
- func (k *Observer) RemoveListener(listener Listener)
- func (k *Observer) RemovePrograms()
- func (k *Observer) Start(ctx context.Context) error
- func (k *Observer) UpdateRuntimeConf() error
- type TestOption
- type TestOptions
Constants ¶
This section is empty.
Variables ¶
var ( /* SensorManager handles dynamic sensors loading / unloading. */ SensorManager *sensors.Manager )
Functions ¶
func AllListeners ¶
func DockerRun ¶
dockerRun starts a new docker container in the background. The container will be killed and removed on test cleanup. It returns the containerId on success, or an error if spawning the container failed.
func LoopEvents ¶
func RemovePrograms ¶
func RemovePrograms(bpfDir, mapDir string)
func WaitForProcess ¶
Used to wait for a process to start, we do a lookup on PROCFS because this may be called before obs is created.
func WriteConfigFile ¶
Types ¶
type Channel ¶
type Channel struct {
// contains filtered or unexported fields
}
Channel is a Listener that gob encodes events and sends them to a network connection.
type Listener ¶
type Listener interface { // Notify gets called for each events from ObserverKprobe. Notify(msg notify.Message) error // Close the listener. io.Closer }
Listener defines the interface to receive events from Observer. Listeners will merge and complete out-of-order events before they're passed to human-readable sinks such as the printer or GRPC encoder.
type Observer ¶
type Observer struct {
// contains filtered or unexported fields
}
Observer represents the link between the BPF perf ring and the listeners. It manages the perf ring and receive events from it. It ensures that the BPF event we are receiving from the kernel is complete. The listeners are notified of their corresponding events.
func GetDefaultObserver ¶
func NewObserver ¶
func (*Observer) AddListener ¶
func (*Observer) InitSensorManager ¶
InitSensorManager starts the sensor controller and stt manager.
func (*Observer) PrintStats ¶
func (k *Observer) PrintStats()
func (*Observer) RemoveListener ¶
func (*Observer) RemovePrograms ¶
func (k *Observer) RemovePrograms()
func (*Observer) UpdateRuntimeConf ¶
UpdateRuntimeConf() Gathers information about Tetragon runtime environment and updates BPF map TetragonConfMap
The observer needs to do this to discover and properly operate on the right cgroup context. Use this function in your tests to allow Pod and Containers association to work.
The environment and cgroup configuration discovery may fail for several reasons, in such cases errors will be logged. Callers can ignore such errors, but we default print a warning that advanced Cgroups tracking will be disabled which might affect process association with kubernetes pods and containers.
type TestOption ¶
type TestOption func(*TestOptions)
func WithConfig ¶
func WithConfig(config string) TestOption
func WithLib ¶
func WithLib(lib string) TestOption
type TestOptions ¶
type TestOptions struct {
// contains filtered or unexported fields
}