Documentation ¶
Index ¶
- Variables
- func AllListeners(msg notify.Message)
- func DataAdd(id dataapi.DataEventId, msgData []byte) error
- func DataGet(id dataapi.DataEventId) ([]byte, error)
- func DataPurge()
- 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, opts ...TestOption) ([]*sensors.Sensor, error)
- func GetMyPid() uint32
- func InitDataCache(size int) error
- 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, opts ...TestOption) (*Observer, error)
- func GetDefaultObserverWithBase(t *testing.T, ctx context.Context, b *sensors.Sensor, file, lib string, ...) (*Observer, error)
- func GetDefaultObserverWithConfig(t *testing.T, ctx context.Context, config, lib string, opts ...TestOption) (*Observer, error)
- func GetDefaultObserverWithFile(t *testing.T, ctx context.Context, file, lib string, opts ...TestOption) (*Observer, error)
- func GetDefaultObserverWithFileNoTest(t *testing.T, ctx context.Context, file, lib string, fail bool, ...) (*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(waitChan chan struct{}) error
- func (k *Observer) LogPinnedBpf(observerDir string)
- func (k *Observer) PrintStats()
- func (k *Observer) ReadErrorEvents() uint64
- func (k *Observer) ReadLostEvents() uint64
- func (k *Observer) ReadReceivedEvents() uint64
- 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(mapDir string) 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 InitDataCache ¶ added in v0.9.0
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 GetDefaultObserverWithConfig ¶ added in v0.10.0
func NewObserver ¶
func (*Observer) AddListener ¶
func (*Observer) InitSensorManager ¶
InitSensorManager starts the sensor controller
func (*Observer) LogPinnedBpf ¶ added in v0.9.0
Log Active pinned BPF resources
func (*Observer) PrintStats ¶
func (k *Observer) PrintStats()
func (*Observer) ReadErrorEvents ¶ added in v0.8.4
func (*Observer) ReadLostEvents ¶ added in v0.8.4
func (*Observer) ReadReceivedEvents ¶ added in v0.8.4
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. On errors we also 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 WithAllowList ¶ added in v0.10.0
func WithAllowList(allowList *tetragon.Filter) TestOption
func WithConfig ¶
func WithConfig(config string) TestOption
func WithDenyList ¶ added in v0.10.0
func WithDenyList(denyList *tetragon.Filter) TestOption
func WithLib ¶
func WithLib(lib string) TestOption
func WithMyPid ¶ added in v0.10.0
func WithMyPid() TestOption
Filter for the gotest process and its children in the export
type TestOptions ¶
type TestOptions struct {
// contains filtered or unexported fields
}