diff --git a/pkg/ebpf/perf.go b/pkg/ebpf/perf.go index c091c80410f50..03773792202f0 100644 --- a/pkg/ebpf/perf.go +++ b/pkg/ebpf/perf.go @@ -27,7 +27,7 @@ var _ EventHandler = new(PerfHandler) type PerfHandler struct { RecordGetter func() *perf.Record - dataChannel chan *DataEvent + dataChannel chan DataEvent lostChannel chan uint64 once sync.Once closed bool @@ -39,7 +39,7 @@ func NewPerfHandler(dataChannelSize int) *PerfHandler { RecordGetter: func() *perf.Record { return recordPool.Get() }, - dataChannel: make(chan *DataEvent, dataChannelSize), + dataChannel: make(chan DataEvent, dataChannelSize), lostChannel: make(chan uint64, 10), } } @@ -58,11 +58,11 @@ func (c *PerfHandler) RecordHandler(record *perf.Record, _ *manager.PerfMap, _ * return } - c.dataChannel <- &DataEvent{Data: record.RawSample, pr: record} + c.dataChannel <- DataEvent{Data: record.RawSample, pr: record} } // DataChannel returns the channel with event data -func (c *PerfHandler) DataChannel() <-chan *DataEvent { +func (c *PerfHandler) DataChannel() <-chan DataEvent { return c.dataChannel } diff --git a/pkg/ebpf/perf_data_event.go b/pkg/ebpf/perf_data_event.go index 82e0625a73b03..b1ba62dd43986 100644 --- a/pkg/ebpf/perf_data_event.go +++ b/pkg/ebpf/perf_data_event.go @@ -15,7 +15,7 @@ import ( // EventHandler is the common interface shared across perf map and perf ring // buffer handlers type EventHandler interface { - DataChannel() <-chan *DataEvent + DataChannel() <-chan DataEvent LostChannel() <-chan uint64 Stop() } diff --git a/pkg/ebpf/perf_ring_buffer.go b/pkg/ebpf/perf_ring_buffer.go index b8a4f6fee3c75..e81e996e34c50 100644 --- a/pkg/ebpf/perf_ring_buffer.go +++ b/pkg/ebpf/perf_ring_buffer.go @@ -27,7 +27,7 @@ var _ EventHandler = new(RingBufferHandler) type RingBufferHandler struct { RecordGetter func() *ringbuf.Record - dataChannel chan *DataEvent + dataChannel chan DataEvent lostChannel chan uint64 once sync.Once closed bool @@ -39,7 +39,7 @@ func NewRingBufferHandler(dataChannelSize int) *RingBufferHandler { RecordGetter: func() *ringbuf.Record { return ringPool.Get() }, - dataChannel: make(chan *DataEvent, dataChannelSize), + dataChannel: make(chan DataEvent, dataChannelSize), // This channel is not really used in the context of ring buffers but // it's here so `RingBufferHandler` and `PerfHandler` can be used // interchangeably @@ -53,11 +53,11 @@ func (c *RingBufferHandler) RecordHandler(record *ringbuf.Record, _ *manager.Rin return } - c.dataChannel <- &DataEvent{Data: record.RawSample, rr: record} + c.dataChannel <- DataEvent{Data: record.RawSample, rr: record} } // DataChannel returns the channel with event data -func (c *RingBufferHandler) DataChannel() <-chan *DataEvent { +func (c *RingBufferHandler) DataChannel() <-chan DataEvent { return c.dataChannel }