workloadmeta

package
v0.0.0-...-7f64411 Latest Latest
Warning

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

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

Documentation

Index

Constants

This section is empty.

Variables

View Source
var DuplicateConnectionErr = errors.New("the stream was closed because another client called StreamEntities")

DuplicateConnectionErr is an error that explains the connection was closed because another client tried to connect

Functions

func Enabled

func Enabled(ddconfig pkgconfigmodel.Reader) bool

Enabled returns whether the extractor should be enabled

Types

type GRPCServer

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

GRPCServer implements a gRPC server to expose Process Entities collected with a WorkloadMetaExtractor

func NewGRPCServer

func NewGRPCServer(config pkgconfigmodel.Reader, extractor *WorkloadMetaExtractor) *GRPCServer

NewGRPCServer creates a new instance of a GRPCServer

func (*GRPCServer) Addr

func (l *GRPCServer) Addr() net.Addr

func (*GRPCServer) Start

func (l *GRPCServer) Start() error

Start starts the GRPCServer to listen for new connections

func (*GRPCServer) Stop

func (l *GRPCServer) Stop()

Stop stops and cleans up resources allocated by the GRPCServer

func (*GRPCServer) StreamEntities

StreamEntities streams Process Entities collected through the WorkloadMetaExtractor

type ProcessCacheDiff

type ProcessCacheDiff struct {
	Creation []*ProcessEntity
	Deletion []*ProcessEntity
	// contains filtered or unexported fields
}

ProcessCacheDiff holds the information about processes that have been created and deleted in the past Extract call from the WorkloadMetaExtractor cache

type ProcessEntity

type ProcessEntity struct {
	//nolint:revive // TODO(PROC) Fix revive linter
	Pid          int32
	ContainerId  string
	NsPid        int32
	CreationTime int64
	Language     *languagemodels.Language
}

ProcessEntity represents a process exposed by the WorkloadMeta extractor

type WorkloadMetaExtractor

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

WorkloadMetaExtractor does these two things:

  • Detecting the language of new processes and sending them to WorkloadMeta
  • Detecting the processes that terminate and sending their PID to WorkloadMeta

func GetSharedWorkloadMetaExtractor

func GetSharedWorkloadMetaExtractor(sysprobeConfig pkgconfigmodel.Reader) *WorkloadMetaExtractor

GetSharedWorkloadMetaExtractor returns a shared WorkloadMetaExtractor

func NewWorkloadMetaExtractor

func NewWorkloadMetaExtractor(sysprobeConfig pkgconfigmodel.Reader) *WorkloadMetaExtractor

NewWorkloadMetaExtractor constructs the WorkloadMetaExtractor.

func (*WorkloadMetaExtractor) Extract

func (w *WorkloadMetaExtractor) Extract(procs map[int32]*procutil.Process)

Extract detects the process language, creates a process entity, and sends that entity to WorkloadMeta

func (*WorkloadMetaExtractor) GetAllProcessEntities

func (w *WorkloadMetaExtractor) GetAllProcessEntities() (map[string]*ProcessEntity, int32)

GetAllProcessEntities returns all processes Entities stored in the WorkloadMetaExtractor cache and the version of the cache at the moment of the read

func (*WorkloadMetaExtractor) ProcessCacheDiff

func (w *WorkloadMetaExtractor) ProcessCacheDiff() <-chan *ProcessCacheDiff

ProcessCacheDiff returns a channel to consume process diffs from

func (*WorkloadMetaExtractor) SetLastPidToCid

func (w *WorkloadMetaExtractor) SetLastPidToCid(pidToCid map[int]string)

SetLastPidToCid is a utility function that should be called from either the process collector, or the process check. pidToCid will be used by the extractor to add enrich process entities with their associated container id. This method was added to avoid the cost of reaching out to workloadMeta on a hot path where `GetContainers` will do an O(n) copy of its entire store. Note that this method is not thread safe.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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