From cf0e69ae1c2a34c8aecd2a26bf99939b935637a7 Mon Sep 17 00:00:00 2001 From: Hunter Gregory <42728408+huntergregory@users.noreply.github.com> Date: Wed, 13 Nov 2024 11:46:25 -0800 Subject: [PATCH] fix(netstat): enable curated stats for tcp connections (#1004) Reduce cardinality of `tcp_connection_stats` by only keeping curated stats. Updates curated stats to include: - timeouts - loss probes - loss retransmit Curation was off, but there were already several curated stats for drops and errors. ### Testing I only see these stats after this change: ``` networkobservability_tcp_connection_stats{statistic_name="TCPLossProbes"} 233948 networkobservability_tcp_connection_stats{statistic_name="TCPLostRetransmit"} 143 networkobservability_tcp_connection_stats{statistic_name="TCPTimeouts"} 240 ``` In a steady state cluster, the first stat seems to slowly increase over time, and the other two are constant. Signed-off-by: Hunter Gregory <42728408+huntergregory@users.noreply.github.com> --- pkg/plugin/linuxutil/linuxutil_linux.go | 2 +- pkg/plugin/linuxutil/types_linux.go | 3 +++ 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/pkg/plugin/linuxutil/linuxutil_linux.go b/pkg/plugin/linuxutil/linuxutil_linux.go index aa4d2d24f9..2733a02117 100644 --- a/pkg/plugin/linuxutil/linuxutil_linux.go +++ b/pkg/plugin/linuxutil/linuxutil_linux.go @@ -67,7 +67,7 @@ func (lu *linuxUtil) run(ctx context.Context) error { return nil case <-ticker.C: opts := &NetstatOpts{ - CuratedKeys: false, + CuratedKeys: true, AddZeroVal: false, ListenSock: false, PrevTCPSockStats: lu.prevTCPSockStats, diff --git a/pkg/plugin/linuxutil/types_linux.go b/pkg/plugin/linuxutil/types_linux.go index c0467360e4..27f7b40dc7 100644 --- a/pkg/plugin/linuxutil/types_linux.go +++ b/pkg/plugin/linuxutil/types_linux.go @@ -35,6 +35,9 @@ var netstatCuratedKeys = map[string]struct{}{ "DataCsumErr": {}, "AddAddrDrop": {}, "RmAddrDrop": {}, + "TCPTimeouts": {}, + "TCPLossProbes": {}, + "TCPLostRetransmit": {}, } type ConnectionStats struct {