Skip to content

Commit 41cb718

Browse files
fix: removed unused option PrevTCPSockStats from linux util (#1924)
# Description I removed unused code from linux_util, specifically PrevTCPSockStats. I also added some entries to gitignore including test-summary(generated after make test) and ignoring logs. ## Related Issue This pr related to #1066 ## Checklist - [x] I have read the [contributing documentation](https://retina.sh/docs/Contributing/overview). - [x] I signed and signed-off the commits (`git commit -S -s ...`). See [this documentation](https://docs.github.com/en/authentication/managing-commit-signature-verification/about-commit-signature-verification) on signing commits. - [x] I have correctly attributed the author(s) of the code. - [x] I have tested the changes locally. - [x] I have followed the project's style guidelines. - [x] I have updated the documentation, if necessary. - [x] I have added tests, if applicable. ## Screenshots (if applicable) or Testing Completed I've provided two screenshots, one from make test, another is just linting. testing <img width="1276" height="743" alt="image" src="https://github.com/user-attachments/assets/4a32cf70-fdd7-4bf8-b2c9-15a3f736421e" /> Linting <img width="1280" height="745" alt="image" src="https://github.com/user-attachments/assets/85cce4db-4824-4eb8-861e-7d1ae24787b7" /> ## Additional Notes Add any additional notes or context about the pull request here. --- Please refer to the [CONTRIBUTING.md](../CONTRIBUTING.md) file for more information on how to contribute to this project. Co-authored-by: Alex Castilio <[email protected]>
1 parent 63b4cb7 commit 41cb718

File tree

3 files changed

+9
-9
lines changed

3 files changed

+9
-9
lines changed

.gitignore

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,9 @@
1717
# Output of the go coverage tool, specifically when used with LiteIDE
1818
*.out
1919

20+
# logs
21+
*.log
22+
2023
# Dependency directories (remove the comment below to include it)
2124
# vendor/
2225

@@ -48,3 +51,5 @@ netperf-*.csv
4851
.certs/
4952

5053
artifacts/
54+
55+
test-summary

pkg/plugin/linuxutil/linuxutil_linux.go

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -82,10 +82,9 @@ func (lu *linuxUtil) run(ctx context.Context) error {
8282
return nil
8383
case <-ticker.C:
8484
opts := &NetstatOpts{
85-
CuratedKeys: true,
86-
AddZeroVal: false,
87-
ListenSock: false,
88-
PrevTCPSockStats: lu.prevTCPSockStats,
85+
CuratedKeys: true,
86+
AddZeroVal: false,
87+
ListenSock: false,
8988
}
9089
var wg sync.WaitGroup
9190

@@ -94,11 +93,10 @@ func (lu *linuxUtil) run(ctx context.Context) error {
9493
wg.Add(1)
9594
go func() {
9695
defer wg.Done()
97-
tcpSocketStats, err := nsReader.readAndUpdate()
96+
_, err := nsReader.readAndUpdate()
9897
if err != nil {
9998
lu.l.Error("Reading netstat failed", zap.Error(err))
10099
}
101-
lu.prevTCPSockStats = tcpSocketStats
102100
}()
103101

104102
ethtoolOpts := &EthtoolOpts{

pkg/plugin/linuxutil/types_linux.go

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -88,9 +88,6 @@ type NetstatOpts struct {
8888

8989
// get only listening sockets
9090
ListenSock bool
91-
92-
// previous TCP socket stats
93-
PrevTCPSockStats *SocketStats
9491
}
9592

9693
type EthtoolStats struct {

0 commit comments

Comments
 (0)