eventcache

package
v1.8.0 Latest Latest
Warning

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

Go to latest
Published: Oct 30, 2026 License: Apache-2.0 Imports: 16 Imported by: 1 module, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

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")
	ErrFailedToGetAncestorsInfo = errors.New("failed to get ancestors info from event cache")
)

Functions

func CacheErrors added in v1.2.0

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.2.0

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.2.0

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(ctx context.Context, n server.Notifier) *Cache

func NewWithTimer

func NewWithTimer(ctx context.Context, 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.

func (*Cache) NeededAncestors added in v1.4.0

func (ec *Cache) NeededAncestors(parent *process.ProcessInternal, ancestors []*process.ProcessInternal) bool

type CacheEntryType added in v1.2.0

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

func (CacheEntryType) String added in v1.2.0

func (t CacheEntryType) String() string

type CacheError added in v1.2.0

type CacheError int
const (
	NilProcessPid CacheError = iota
)

func (CacheError) String added in v1.2.0

func (e CacheError) String() string

type CacheObj

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

type Expirer added in v1.8.0

type Expirer interface {
	Expire(startTime uint64)
}

Expirer is implemented by messages that hold process references which must be released when the cache stops retrying them.

Jump to

Keyboard shortcuts

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