From ef16359caa4ff92c6343048e3d82074ce1796aa2 Mon Sep 17 00:00:00 2001 From: Stuart Geipel Date: Mon, 16 Dec 2024 10:54:09 -0800 Subject: [PATCH] implement feedback --- pkg/network/tracer/connection/ebpfless/tcp_processor.go | 2 +- pkg/network/tracer/connection/ebpfless_tracer.go | 8 +++++--- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/pkg/network/tracer/connection/ebpfless/tcp_processor.go b/pkg/network/tracer/connection/ebpfless/tcp_processor.go index c071971f78f1f..c83a5430b96f1 100644 --- a/pkg/network/tracer/connection/ebpfless/tcp_processor.go +++ b/pkg/network/tracer/connection/ebpfless/tcp_processor.go @@ -70,7 +70,7 @@ type TCPProcessor struct { } // TODO make this into a config value -const maxPendingConns = 1024 +const maxPendingConns = 4096 // NewTCPProcessor constructs an empty TCPProcessor func NewTCPProcessor(cfg *config.Config) *TCPProcessor { diff --git a/pkg/network/tracer/connection/ebpfless_tracer.go b/pkg/network/tracer/connection/ebpfless_tracer.go index bd9c60ea43aa2..88c744239fd39 100644 --- a/pkg/network/tracer/connection/ebpfless_tracer.go +++ b/pkg/network/tracer/connection/ebpfless_tracer.go @@ -242,9 +242,11 @@ func (t *ebpfLessTracer) processConnection( case ebpfless.ProcessResultStoreConn: maxTrackedConns := int(t.config.MaxTrackedConnections) ok := ebpfless.WriteMapWithSizeLimit(t.conns, conn.ConnectionTuple, conn, maxTrackedConns) - // we don't have enough space to add this connection, remove its TCP state tracking - if !ok && conn.Type == network.TCP { - t.tcp.RemoveConn(conn.ConnectionTuple) + if !ok { + // we don't have enough space to add this connection, remove its TCP state tracking + if conn.Type == network.TCP { + t.tcp.RemoveConn(conn.ConnectionTuple) + } ebpfLessTracerTelemetry.droppedConnections.Inc() } case ebpfless.ProcessResultCloseConn: