Skip to content

Commit

Permalink
tetragon: Remove option.Config.MapDir variable
Browse files Browse the repository at this point in the history
Removing option.Config.MapDir variable, it's no longer used.

Signed-off-by: Jiri Olsa <jolsa@kernel.org>
  • Loading branch information
olsajiri committed Feb 21, 2024
1 parent b476825 commit a1006ad
Show file tree
Hide file tree
Showing 6 changed files with 3 additions and 8 deletions.
3 changes: 1 addition & 2 deletions cmd/tetragon/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -259,7 +259,6 @@ func tetragonExecute() error {
// Get observer bpf maps and programs directory
observerDir := getObserverDir()
option.Config.BpfDir = observerDir
option.Config.MapDir = observerDir

// Check if option to remove old BPF and maps is enabled.
if option.Config.ReleasePinned {
Expand Down Expand Up @@ -353,7 +352,7 @@ func tetragonExecute() error {
}

// Probe runtime configuration and do not fail on errors
obs.UpdateRuntimeConf(option.Config.MapDir)
obs.UpdateRuntimeConf(option.Config.BpfDir)

var k8sWatcher watcher.K8sResourceWatcher
if option.Config.EnableK8s {
Expand Down
1 change: 0 additions & 1 deletion pkg/bench/bench.go
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,6 @@ func runTetragon(ctx context.Context, configFile string, args *Arguments, summar
option.Config.RBSize = args.RBSize

option.Config.BpfDir = bpf.MapPrefixPath()
option.Config.MapDir = bpf.MapPrefixPath()
obs := observer.NewObserver(configFile)

if err := obs.InitSensorManager(nil); err != nil {
Expand Down
2 changes: 1 addition & 1 deletion pkg/metrics/eventmetrics/collector.go
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ func (c *bpfCollector) Describe(ch chan<- *prometheus.Desc) {
}

func (c *bpfCollector) Collect(ch chan<- prometheus.Metric) {
mapHandle, err := ebpf.LoadPinnedMap(filepath.Join(option.Config.MapDir, "tg_stats_map"), nil)
mapHandle, err := ebpf.LoadPinnedMap(filepath.Join(option.Config.BpfDir, "tg_stats_map"), nil)
if err != nil {
return
}
Expand Down
2 changes: 1 addition & 1 deletion pkg/observer/observer_stats.go
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ func (c *bpfCollector) Collect(ch chan<- prometheus.Metric) {
continue
}
processedMaps[name] = true
pin := filepath.Join(option.Config.MapDir, name)
pin := filepath.Join(option.Config.BpfDir, name)
// Skip map names that end up with _stats.
// This will result in _stats_stats suffixes that we don't care about
if strings.HasSuffix(pin, statsSuffix) {
Expand Down
2 changes: 0 additions & 2 deletions pkg/observer/observertesthelper/observer_test_helper.go
Original file line number Diff line number Diff line change
Expand Up @@ -207,7 +207,6 @@ func newDefaultTestOptions(opts ...TestOption) *TestOptions {

func newDefaultObserver(oo *testObserverOptions) *observer.Observer {
option.Config.BpfDir = bpf.MapPrefixPath()
option.Config.MapDir = bpf.MapPrefixPath()
return observer.NewObserver(oo.config)
}

Expand Down Expand Up @@ -312,7 +311,6 @@ func GetDefaultSensorsWithFile(tb testing.TB, file, lib string, opts ...TestOpti
opts = append(opts, WithLib(lib))

option.Config.BpfDir = bpf.MapPrefixPath()
option.Config.MapDir = bpf.MapPrefixPath()

testutils.CaptureLog(tb, logger.GetLogger().(*logrus.Logger))

Expand Down
1 change: 0 additions & 1 deletion pkg/option/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,6 @@ type config struct {

GopsAddr string

MapDir string
BpfDir string

LogOpts map[string]string
Expand Down

0 comments on commit a1006ad

Please sign in to comment.