eventcache

package
v1.3.2 Latest Latest
Warning

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

Go to latest
Published: Dec 23, 2024 License: Apache-2.0 Imports: 14 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// Event information was completed without cache retries
	NO_EV_CACHE = iota
	// Cache retries was triggered in order to complete event information
	FROM_EV_CACHE
)

Variables

View Source
var (
	ErrFailedToGetPodInfo     = errors.New("failed to get pod info from event cache")
	ErrFailedToGetProcessInfo = errors.New("failed to get process info from event cache")
	ErrFailedToGetParentInfo  = errors.New("failed to get parent info from event cache")
)

Functions

func CacheErrors added in v1.3.2

func CacheErrors(er CacheError, eventType tetragon.EventType) prometheus.Counter

Get a new handle on an eventCacheErrorsTotal metric for an error

func CacheRetries added in v1.3.2

func CacheRetries(entryType CacheEntryType) prometheus.Counter

Get a new handle on an eventCacheRetriesTotal metric for an entryType

func HandleGenericEvent

func HandleGenericEvent(internal *process.ProcessInternal, ev notify.Event, tid *uint32) error

Generic Event handler without any extra msg specific details or debugging so we only need to wait for the internal link to the process context to resolve PodInfo. This happens when the msg populates the internal state but that event is not fully populated yet.

func HandleGenericInternal

func HandleGenericInternal(ev notify.Event, pid uint32, tid *uint32, timestamp uint64) (*process.ProcessInternal, error)

Generic internal lookup happens when events are received out of order and this event was handled before an exec event so it wasn't able to populate the process info yet.

func RegisterMetrics added in v1.3.2

func RegisterMetrics(group metrics.Group)

Types

type Cache

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

func Get

func Get() *Cache

func New

func New(n server.Notifier) *Cache

func NewWithTimer

func NewWithTimer(n server.Notifier, dur time.Duration) *Cache

func (*Cache) Add

func (ec *Cache) Add(internal *process.ProcessInternal,
	e notify.Event,
	t uint64,
	s uint64,
	msg notify.Message)

func (*Cache) Needed

func (ec *Cache) Needed(proc *tetragon.Process) bool

We handle two race conditions here one where the event races with a Tetragon execve event and the other -- much more common -- where we race with K8s watcher case 1 (execve race):

Its possible to receive this Tetragon event before the process event cache
has been populated with a Tetragon execve event. In this case we need to
cache the event until the process cache is populated.

case 2 (k8s watcher race):

Its possible to receive an event before the k8s watcher receives the
podInfo event and populates the local cache. If we expect podInfo,
indicated by having a nonZero dockerID we cache the event until the
podInfo arrives.

type CacheEntryType added in v1.3.2

type CacheEntryType int
const (
	ProcessInfo CacheEntryType = iota
	ParentInfo
	PodInfo
)

func (CacheEntryType) String added in v1.3.2

func (t CacheEntryType) String() string

type CacheError added in v1.3.2

type CacheError int
const (
	NilProcessPid CacheError = iota
)

func (CacheError) String added in v1.3.2

func (e CacheError) String() string

type CacheObj

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

Jump to

Keyboard shortcuts

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