Skip to content

Commit

Permalink
Fix typo in EBPFTracer (#1494)
Browse files Browse the repository at this point in the history
  • Loading branch information
rafaelroquetto authored Jan 7, 2025
1 parent a24f720 commit 9302cf1
Show file tree
Hide file tree
Showing 11 changed files with 21 additions and 21 deletions.
4 changes: 2 additions & 2 deletions pkg/beyla/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ var DefaultConfig = Config{
ChannelBufferLen: 10,
LogLevel: "INFO",
EnforceSysCaps: false,
EBPF: config.EPPFTracer{
EBPF: config.EBPFTracer{
BatchLength: 100,
BatchTimeout: time.Second,
HTTPRequestTimeout: 30 * time.Second,
Expand Down Expand Up @@ -132,7 +132,7 @@ var DefaultConfig = Config{
}

type Config struct {
EBPF config.EPPFTracer `yaml:"ebpf"`
EBPF config.EBPFTracer `yaml:"ebpf"`

// NetworkFlows configuration for Network Observability feature
NetworkFlows NetworkConfig `yaml:"network"`
Expand Down
6 changes: 3 additions & 3 deletions pkg/beyla/config_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -120,7 +120,7 @@ network:
EnforceSysCaps: false,
Printer: false,
TracePrinter: "json",
EBPF: config.EPPFTracer{
EBPF: config.EBPFTracer{
BatchLength: 100,
BatchTimeout: time.Second,
HTTPRequestTimeout: 30 * time.Second,
Expand Down Expand Up @@ -458,7 +458,7 @@ time=\S+ level=DEBUG msg=debug arg=debug$`),
tracing: true,
expectedCfg: Config{
TracePrinter: debug.TracePrinterText,
EBPF: config.EPPFTracer{BpfDebug: true},
EBPF: config.EBPFTracer{BpfDebug: true},
},
}, {
name: "debug log with network flows",
Expand All @@ -472,7 +472,7 @@ time=\S+ level=DEBUG msg=debug arg=debug$`),
tracing: true,
expectedCfg: Config{
TracePrinter: debug.TracePrinterText,
EBPF: config.EPPFTracer{BpfDebug: true},
EBPF: config.EBPFTracer{BpfDebug: true},
NetworkFlows: NetworkConfig{Enable: true, Print: true},
},
}} {
Expand Down
4 changes: 2 additions & 2 deletions pkg/config/ebpf_tracer.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@ package config

import "time"

// EPPFTracer configuration for eBPF programs
type EPPFTracer struct {
// EBPFTracer configuration for eBPF programs
type EBPFTracer struct {
BpfDebug bool `yaml:"bpf_debug" env:"BEYLA_BPF_DEBUG"`

// WakeupLen specifies how many messages need to be accumulated in the eBPF ringbuffer
Expand Down
2 changes: 1 addition & 1 deletion pkg/internal/ebpf/common/common.go
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,7 @@ var MisclassifiedEvents = make(chan MisclassifiedEvent)

func ptlog() *slog.Logger { return slog.With("component", "ebpf.ProcessTracer") }

func ReadBPFTraceAsSpan(cfg *config.EPPFTracer, record *ringbuf.Record, filter ServiceFilter) (request.Span, bool, error) {
func ReadBPFTraceAsSpan(cfg *config.EBPFTracer, record *ringbuf.Record, filter ServiceFilter) (request.Span, bool, error) {
var eventType uint8

// we read the type first, depending on the type we decide what kind of record we have
Expand Down
10 changes: 5 additions & 5 deletions pkg/internal/ebpf/common/ringbuf.go
Original file line number Diff line number Diff line change
Expand Up @@ -30,15 +30,15 @@ var readerFactory = func(rb *ebpf.Map) (ringBufReader, error) {
}

type ringBufForwarder struct {
cfg *config.EPPFTracer
cfg *config.EBPFTracer
logger *slog.Logger
ringbuffer *ebpf.Map
closers []io.Closer
spans []request.Span
spansLen int
access sync.Mutex
ticker *time.Ticker
reader func(*config.EPPFTracer, *ringbuf.Record, ServiceFilter) (request.Span, bool, error)
reader func(*config.EBPFTracer, *ringbuf.Record, ServiceFilter) (request.Span, bool, error)
// filter the input spans, eliminating these from processes whose PID
// belong to a process that does not match the discovery policies
filter ServiceFilter
Expand All @@ -52,7 +52,7 @@ var singleRbfLock sync.Mutex
// internal buffer, and forwards them to an output events channel, previously converted to request.Span
// instances.
func SharedRingbuf(
cfg *config.EPPFTracer,
cfg *config.EBPFTracer,
filter ServiceFilter,
ringbuffer *ebpf.Map,
metrics imetrics.Reporter,
Expand All @@ -75,10 +75,10 @@ func SharedRingbuf(
}

func ForwardRingbuf(
cfg *config.EPPFTracer,
cfg *config.EBPFTracer,
ringbuffer *ebpf.Map,
filter ServiceFilter,
reader func(*config.EPPFTracer, *ringbuf.Record, ServiceFilter) (request.Span, bool, error),
reader func(*config.EBPFTracer, *ringbuf.Record, ServiceFilter) (request.Span, bool, error),
logger *slog.Logger,
metrics imetrics.Reporter,
closers ...io.Closer,
Expand Down
6 changes: 3 additions & 3 deletions pkg/internal/ebpf/common/ringbuf_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ func TestForwardRingbuf_CapacityFull(t *testing.T) {
fltr := TestPidsFilter{services: map[uint32]svc.Attrs{}}
fltr.AllowPID(1, 1, &svc.Attrs{UID: svc.UID{Name: "myService"}}, PIDTypeGo)
go ForwardRingbuf(
&config.EPPFTracer{BatchLength: 10},
&config.EBPFTracer{BatchLength: 10},
nil, // the source ring buffer can be null
&fltr,
ReadBPFTraceAsSpan,
Expand Down Expand Up @@ -86,7 +86,7 @@ func TestForwardRingbuf_Deadline(t *testing.T) {
fltr := TestPidsFilter{services: map[uint32]svc.Attrs{}}
fltr.AllowPID(1, 1, &svc.Attrs{UID: svc.UID{Name: "myService"}}, PIDTypeGo)
go ForwardRingbuf(
&config.EPPFTracer{BatchLength: 10, BatchTimeout: 20 * time.Millisecond},
&config.EBPFTracer{BatchLength: 10, BatchTimeout: 20 * time.Millisecond},
nil, // the source ring buffer can be null
&fltr, // change fltr to a pointer
ReadBPFTraceAsSpan,
Expand Down Expand Up @@ -126,7 +126,7 @@ func TestForwardRingbuf_Close(t *testing.T) {
metrics := &metricsReporter{}
closable := closableObject{}
go ForwardRingbuf(
&config.EPPFTracer{BatchLength: 10},
&config.EBPFTracer{BatchLength: 10},
nil, // the source ring buffer can be null
(&IdentityPidsFilter{}),
ReadBPFTraceAsSpan,
Expand Down
2 changes: 1 addition & 1 deletion pkg/internal/ebpf/common/tcp_detect_transform.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ import (
)

// nolint:cyclop
func ReadTCPRequestIntoSpan(cfg *config.EPPFTracer, record *ringbuf.Record, filter ServiceFilter) (request.Span, bool, error) {
func ReadTCPRequestIntoSpan(cfg *config.EBPFTracer, record *ringbuf.Record, filter ServiceFilter) (request.Span, bool, error) {
var event TCPRequestInfo

err := binary.Read(bytes.NewBuffer(record.RawSample), binary.LittleEndian, &event)
Expand Down
2 changes: 1 addition & 1 deletion pkg/internal/ebpf/common/tcp_detect_transform_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,7 @@ func TestReadTCPRequestIntoSpan_Overflow(t *testing.T) {
},
}

cfg := config.EPPFTracer{HeuristicSQLDetect: true}
cfg := config.EBPFTracer{HeuristicSQLDetect: true}

binaryRecord := bytes.Buffer{}
require.NoError(t, binary.Write(&binaryRecord, binary.LittleEndian, tri))
Expand Down
2 changes: 1 addition & 1 deletion pkg/internal/ebpf/gotracer/gotracer.go
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ import (
type Tracer struct {
log *slog.Logger
pidsFilter ebpfcommon.ServiceFilter
cfg *config.EPPFTracer
cfg *config.EBPFTracer
metrics imetrics.Reporter
bpfObjects bpfObjects
closers []io.Closer
Expand Down
2 changes: 1 addition & 1 deletion pkg/internal/ebpf/logger/logger.go
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ func (p *BPFLogger) Run(ctx context.Context) {
)(ctx, nil)
}

func (p *BPFLogger) processLogEvent(_ *config.EPPFTracer, record *ringbuf.Record, _ ebpfcommon.ServiceFilter) (request.Span, bool, error) {
func (p *BPFLogger) processLogEvent(_ *config.EBPFTracer, record *ringbuf.Record, _ ebpfcommon.ServiceFilter) (request.Span, bool, error) {
var event BPFLogInfo

err := binary.Read(bytes.NewBuffer(record.RawSample), binary.LittleEndian, &event)
Expand Down
2 changes: 1 addition & 1 deletion pkg/internal/ebpf/watcher/watcher.go
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,7 @@ func (p *Watcher) Run(ctx context.Context) {
)(ctx, nil)
}

func (p *Watcher) processWatchEvent(_ *config.EPPFTracer, record *ringbuf.Record, _ ebpfcommon.ServiceFilter) (request.Span, bool, error) {
func (p *Watcher) processWatchEvent(_ *config.EBPFTracer, record *ringbuf.Record, _ ebpfcommon.ServiceFilter) (request.Span, bool, error) {
var flags uint64
var event BPFWatchInfo

Expand Down

0 comments on commit 9302cf1

Please sign in to comment.