Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

remove unused option PrevTCPSockStats from linux util #1197

Open
wants to merge 5 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 4 additions & 15 deletions pkg/plugin/linuxutil/linuxutil_linux.go
Original file line number Diff line number Diff line change
Expand Up @@ -71,24 +71,12 @@ func (lu *linuxUtil) run(ctx context.Context) error {
return nil
case <-ticker.C:
opts := &NetstatOpts{
CuratedKeys: true,
AddZeroVal: false,
ListenSock: false,
PrevTCPSockStats: lu.prevTCPSockStats,
CuratedKeys: true,
AddZeroVal: false,
ListenSock: false,
}
var wg sync.WaitGroup

ns := &Netstat{}
nsReader := NewNetstatReader(opts, ns)
wg.Add(1)
go func() {
defer wg.Done()
tcpSocketStats, err := nsReader.readAndUpdate()
if err != nil {
lu.l.Error("Reading netstat failed", zap.Error(err))
}
lu.prevTCPSockStats = tcpSocketStats
}()

ethtoolOpts := &EthtoolOpts{
errOrDropKeysOnly: true,
Expand All @@ -107,6 +95,7 @@ func (lu *linuxUtil) run(ctx context.Context) error {
lu.l.Error("Error while creating ethReader")
return fmt.Errorf("error while creating ethReader")
}
var wg sync.WaitGroup
wg.Add(1)
go func() {
defer wg.Done()
Expand Down
10 changes: 3 additions & 7 deletions pkg/plugin/linuxutil/types_linux.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,10 +12,9 @@ const name = "linuxutil"

//go:generate go run go.uber.org/mock/[email protected] -source=types_linux.go -destination=linuxutil_mock_generated_linux.go -package=linuxutil
type linuxUtil struct {
cfg *kcfg.Config
l *log.ZapLogger
isRunning bool
prevTCPSockStats *SocketStats
cfg *kcfg.Config
l *log.ZapLogger
isRunning bool
}

var netstatCuratedKeys = map[string]struct{}{
Expand Down Expand Up @@ -86,9 +85,6 @@ type NetstatOpts struct {

// get only listening sockets
ListenSock bool

// previous TCP socket stats
PrevTCPSockStats *SocketStats
}

type EthtoolStats struct {
Expand Down