ebpfcommon

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Sep 12, 2023 License: Apache-2.0 Imports: 20 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ForwardRingbuf

func ForwardRingbuf[T any](
	svcName string,
	cfg *TracerConfig,
	logger *slog.Logger,
	ringbuffer *ebpf.Map,
	reader func(*ringbuf.Record) (request.Span, error),
	metrics imetrics.Reporter,
	closers ...io.Closer,
) node.StartFuncCtx[[]request.Span]

ForwardRingbuf returns a function reads HTTPRequestTraces from an input ring buffer, accumulates them into an internal buffer, and forwards them to an output events channel, previously converted to request.Span instances. Despite it returns a StartFuncCtx, this is not used inside the Pipes' library but it's invoked directly in the code as a simple function.

func HTTPRequestTraceToSpan added in v0.0.5

func HTTPRequestTraceToSpan(trace *HTTPRequestTrace) request.Span

func ReadHTTPRequestTraceAsSpan added in v0.0.5

func ReadHTTPRequestTraceAsSpan(record *ringbuf.Record) (request.Span, error)

Types

type Filter

type Filter struct {
	io.Closer
	Fd int
}

func (*Filter) Close

func (f *Filter) Close() error

type FunctionPrograms

type FunctionPrograms struct {
	// Required, if true, will cancel the execution of the eBPF Tracer
	// if the function has not been found in the executable
	Required bool
	Start    *ebpf.Program
	End      *ebpf.Program
}

type HTTPRequestTrace

type HTTPRequestTrace bpfHttpRequestTrace

HTTPRequestTrace contains information from an HTTP request as directly received from the eBPF layer. This contains low-level C structures for accurate binary read from ring buffer.

type Probe

type Probe struct {
	Offsets  goexec.FuncOffsets
	Programs FunctionPrograms
}

Probe holds the information of the instrumentation points of a given function: its start and end offsets and eBPF programs

type TracerConfig

type TracerConfig struct {
	// Exec allows selecting the instrumented executable whose complete path contains the Exec value.
	Exec string `yaml:"executable_name" env:"EXECUTABLE_NAME"`
	// Port allows selecting the instrumented executable that owns the Port value. If this value is set (and
	// different to zero), the value of the Exec property won't take effect.
	// It's important to emphasize that if your process opens multiple HTTP/GRPC ports, the auto-instrumenter
	// will instrument all the service calls in all the ports, not only the port specified here.
	Port int `yaml:"open_port" env:"OPEN_PORT"`
	// SystemWide allows instrumentation of all HTTP (no gRPC) calls, incoming and outgoing at a system wide scale.
	// No filtering per application will be done. Using this option may result in reduced quality of information
	// gathered for certain languages, such as Golang.
	SystemWide bool   `yaml:"system_wide" env:"SYSTEM_WIDE"`
	LogLevel   string `yaml:"log_level" env:"LOG_LEVEL"`
	BpfDebug   bool   `yaml:"bfp_debug" env:"BPF_DEBUG"`

	// WakeupLen specifies how many messages need to be accumulated in the eBPF ringbuffer
	// before sending a wakeup request.
	// High values of WakeupLen could add a noticeable metric delay in services with low
	// requests/second.
	// TODO: see if there is a way to force eBPF to wakeup userspace on timeout
	WakeupLen int `yaml:"wakeup_len" env:"BPF_WAKEUP_LEN"`
	// BatchLength allows specifying how many traces will be batched at the initial
	// stage before being forwarded to the next stage
	BatchLength int `yaml:"batch_length" env:"BPF_BATCH_LENGTH"`
	// BatchTimeout specifies the timeout to forward the data batch if it didn't
	// reach the BatchLength size
	BatchTimeout time.Duration `yaml:"batch_timeout" env:"BPF_BATCH_TIMEOUT"`

	// BpfBaseDir specifies the base directory where the BPF pinned maps will be mounted.
	// By default, it will be /var/run/beyla
	BpfBaseDir string `yaml:"bpf_fs_base_dir" env:"BPF_FS_BASE_DIR"`

	// This can be enabled to use generic HTTP tracers only, no Go-specifics will be used:
	SkipGoSpecificTracers bool `yaml:"skip_go_specific_tracers" env:"SKIP_GO_SPECIFIC_TRACERS"`
}

TracerConfig configuration for eBPF programs

Jump to

Keyboard shortcuts

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