move fsStats creation to NewAgent function

This commit is contained in:
Henry Dollman
2024-10-10 18:18:57 -04:00
parent 4245da7792
commit 64f0a23969
2 changed files with 1 additions and 3 deletions

View File

@@ -29,6 +29,7 @@ func NewAgent() *Agent {
return &Agent{
sensorsContext: context.Background(),
memCalc: os.Getenv("MEM_CALC"),
fsStats: make(map[string]*system.FsStats),
}
}

View File

@@ -18,9 +18,6 @@ func (a *Agent) initializeDiskInfo() {
efPath := "/extra-filesystems"
hasRoot := false
// Create map for disk stats
a.fsStats = make(map[string]*system.FsStats)
partitions, err := disk.Partitions(false)
if err != nil {
slog.Error("Error getting disk partitions", "err", err)