Skip to content

Commit

Permalink
update debug log locations
Browse files Browse the repository at this point in the history
  • Loading branch information
henrygd committed Oct 16, 2024
1 parent 1a3ad04 commit ee92e33
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 7 deletions.
3 changes: 3 additions & 0 deletions beszel/internal/agent/agent.go
Original file line number Diff line number Diff line change
Expand Up @@ -83,9 +83,11 @@ func (a *Agent) gatherStats() system.CombinedData {
Stats: a.getSystemStats(),
Info: a.systemInfo,
}
slog.Debug("System stats", "data", systemData)
// add docker stats
if containerStats, err := a.dockerManager.getDockerStats(); err == nil {
systemData.Containers = containerStats
slog.Debug("Docker stats", "data", systemData.Containers)
} else {
slog.Debug("Error getting docker stats", "err", err)
}
Expand All @@ -96,5 +98,6 @@ func (a *Agent) gatherStats() system.CombinedData {
systemData.Stats.ExtraFs[name] = stats
}
}
slog.Debug("Extra filesystems", "data", systemData.Stats.ExtraFs)
return systemData
}
1 change: 0 additions & 1 deletion beszel/internal/agent/server.go
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,6 @@ func (a *Agent) startServer(pubKey []byte, addr string) {

func (a *Agent) handleSession(s sshServer.Session) {
stats := a.gatherStats()
slog.Debug("Sending stats", "data", stats)
if err := json.NewEncoder(s).Encode(stats); err != nil {
slog.Error("Error encoding stats", "err", err)
s.Exit(1)
Expand Down
6 changes: 0 additions & 6 deletions beszel/internal/agent/system.go
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,6 @@ func (a *Agent) getSystemStats() system.Stats {
systemStats := system.Stats{}

// cpu percent
slog.Debug("Getting cpu percent")
cpuPct, err := cpu.Percent(0, false)
if err != nil {
slog.Error("Error getting cpu percent", "err", err)
Expand All @@ -62,7 +61,6 @@ func (a *Agent) getSystemStats() system.Stats {
}

// memory
slog.Debug("Getting memory stats")
if v, err := mem.VirtualMemory(); err == nil {
// swap
systemStats.Swap = bytesToGigabytes(v.SwapTotal)
Expand Down Expand Up @@ -91,7 +89,6 @@ func (a *Agent) getSystemStats() system.Stats {
}

// disk usage
slog.Debug("Getting disk stats")
for _, stats := range a.fsStats {
if d, err := disk.Usage(stats.Mountpoint); err == nil {
stats.DiskTotal = bytesToGigabytes(d.Total)
Expand All @@ -112,7 +109,6 @@ func (a *Agent) getSystemStats() system.Stats {
}

// disk i/o
slog.Debug("Getting disk I/O stats")
if ioCounters, err := disk.IOCounters(a.fsNames...); err == nil {
for _, d := range ioCounters {
stats := a.fsStats[d.Name]
Expand All @@ -136,7 +132,6 @@ func (a *Agent) getSystemStats() system.Stats {
}

// network stats
slog.Debug("Getting network stats")
if netIO, err := psutilNet.IOCounters(true); err == nil {
secondsElapsed := time.Since(a.netIoStats.Time).Seconds()
a.netIoStats.Time = time.Now()
Expand Down Expand Up @@ -177,7 +172,6 @@ func (a *Agent) getSystemStats() system.Stats {
}

// temperatures
slog.Debug("Getting temperatures")
temps, err := sensors.TemperaturesWithContext(a.sensorsContext)
if err != nil && a.debug {
err.(*sensors.Warnings).Verbose = true
Expand Down

0 comments on commit ee92e33

Please sign in to comment.