Skip to content

Commit

Permalink
Merge pull request #139 from jzwlqx/feature/optimize_netop
Browse files Browse the repository at this point in the history
optimal nettop so that we avoid scan the whole /proc
  • Loading branch information
BSWANG authored Jan 10, 2024
2 parents 9751cc0 + 81bbd42 commit e276b14
Show file tree
Hide file tree
Showing 17 changed files with 555 additions and 935 deletions.
4 changes: 4 additions & 0 deletions bpf/netns.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@

SEC("tracepoint/task/newtask")
int netns(){
}
1 change: 0 additions & 1 deletion pkg/exporter/cmd/list_probe.go
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,6 @@ var (
indent := " "
for _, s := range l {
fmt.Printf("%s%s\n", indent, s)

}
}
},
Expand Down
3 changes: 0 additions & 3 deletions pkg/exporter/cmd/root.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,6 @@ import (

log "github.com/sirupsen/logrus"

"github.com/alibaba/kubeskoop/pkg/exporter/nettop"

"github.com/spf13/cobra"
)

Expand All @@ -16,7 +14,6 @@ var (
Use: "inspector",
Short: "network inspection tool",
PersistentPreRun: func(cmd *cobra.Command, args []string) {
nettop.Init(sidecar)
if debug {
log.SetLevel(log.DebugLevel)
} else {
Expand Down
6 changes: 5 additions & 1 deletion pkg/exporter/cmd/server.go
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,11 @@ var (
}

// nolint
go nettop.StartCache(insp.ctx)
if err := nettop.StartCache(insp.ctx, sidecar); err != nil {
log.Errorf("failed start cache: %v", err)
return
}

defer nettop.StopCache()

// config hot reload process
Expand Down
Loading

0 comments on commit e276b14

Please sign in to comment.