ebpf

package
v1.0.1 Latest Latest
Warning

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

Go to latest
Published: Nov 16, 2023 License: Apache-2.0 Imports: 21 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func RunUtilityTracer added in v0.4.2

func RunUtilityTracer(p UtilityTracer) error

Types

type CommonTracer added in v0.4.2

type CommonTracer interface {
	// Load the bpf object that is generated by the bpf2go compiler
	Load() (*ebpf.CollectionSpec, error)
	// AddCloser adds io.Closer instances that need to be invoked when the
	// Run function ends.
	AddCloser(c ...io.Closer)
	// BpfObjects that are created by the bpf2go compiler
	BpfObjects() any
}

type KprobesTracer added in v0.4.2

type KprobesTracer interface {
	CommonTracer
	// KProbes returns a map with the name of the kernel probes that need to be
	// tapped into. Start matches kprobe, End matches kretprobe
	KProbes() map[string]ebpfcommon.FunctionPrograms
}

type PIDsAccounter added in v0.3.2

type PIDsAccounter interface {
	// AllowPID notifies the tracer to accept traces from the process with the
	// provided PID. Unless system-wide instrumentation, the Tracer should discard
	// traces from processes whose PID has not been allowed before
	AllowPID(uint32)
	// BlockPID notifies the tracer to stop accepting traces from the process
	// with the provided PID. After receiving them via ringbuffer, it should
	// discard them.
	BlockPID(uint32)
}

type ProcessTracer

type ProcessTracer struct {
	Programs []Tracer
	ELFInfo  *exec.FileInfo
	Goffsets *goexec.Offsets
	Exe      *link.Executable
	PinPath  string

	SystemWide bool
	// contains filtered or unexported fields
}

ProcessTracer instruments an executable with eBPF and provides the eBPF readers that will forward the traces to later stages in the pipeline

func (*ProcessTracer) AllowPID added in v0.3.2

func (pt *ProcessTracer) AllowPID(pid uint32)

func (*ProcessTracer) BlockPID added in v0.3.2

func (pt *ProcessTracer) BlockPID(pid uint32)

func (*ProcessTracer) Run

func (pt *ProcessTracer) Run(ctx context.Context, out chan<- []request.Span)

type Tracer

type Tracer interface {
	PIDsAccounter
	KprobesTracer
	// Constants returns a map of constants to be overriden into the eBPF program.
	// The key is the constant name and the value is the value to overwrite.
	Constants(*exec.FileInfo, *goexec.Offsets) map[string]any
	// GoProbes returns a map with the name of Go functions that need to be inspected
	// in the executable, as well as the eBPF programs that optionally need to be
	// inserted as the Go function start and end probes
	GoProbes() map[string]ebpfcommon.FunctionPrograms
	// UProbes returns a map with the module name mapping to the uprobes that need to be
	// tapped into. Start matches uprobe, End matches uretprobe
	UProbes() map[string]map[string]ebpfcommon.FunctionPrograms
	// SocketFilters  returns a list of programs that need to be loaded as a
	// generic eBPF socket filter
	SocketFilters() []*ebpf.Program
	// Run will do the action of listening for eBPF traces and forward them
	// periodically to the output channel.
	// It optionally receives the service svc.ID, to
	// populate each forwarded span with its value. But some
	// tracers might ignore it (e.g. system-wide HTTP filter will directly set the
	// executable name of each request).
	Run(context.Context, chan<- []request.Span, svc.ID)
}

Tracer is an individual eBPF program (e.g. the net/http or the grpc tracers)

type UtilityTracer added in v0.4.2

type UtilityTracer interface {
	KprobesTracer
	Run(context.Context)
}

Subset of the above interface, which supports loading eBPF programs which are not tied to service monitoring

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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