Skip to content

Commit

Permalink
bugtool: run debug maps command in bugtool
Browse files Browse the repository at this point in the history
Store the results in debugmaps.json.

Signed-off-by: Mahe Tardy <[email protected]>
  • Loading branch information
mtardy authored and kkourt committed Oct 3, 2024
1 parent dbd43f7 commit b845af4
Showing 1 changed file with 18 additions and 0 deletions.
18 changes: 18 additions & 0 deletions pkg/bugtool/bugtool.go
Original file line number Diff line number Diff line change
Expand Up @@ -261,6 +261,7 @@ func doBugtool(info *InitInfo, outFname string) error {
si.addGrpcInfo(tarWriter)
si.addPmapOut(tarWriter)
si.addMemCgroupStats(tarWriter)
si.addBPFMapsStats(tarWriter)
return nil
}

Expand Down Expand Up @@ -755,3 +756,20 @@ func (s bugtoolInfo) addMemCgroupStats(tarWriter *tar.Writer) error {

return nil
}

func (s bugtoolInfo) addBPFMapsStats(tarWriter *tar.Writer) error {
out, err := RunMapsChecks()
if err != nil {
s.multiLog.WithError(err).Warn("failed to run BPF maps checks")
return fmt.Errorf("failed to run BPF maps checks: %w", err)
}

const file = "debugmaps.json"
err = s.tarAddJson(tarWriter, file, out)
if err != nil {
s.multiLog.WithError(err).Warn("failed to add the BPF maps checks to the tar archive")
return err
}
s.multiLog.WithField("file", file).Info("BPF maps checks added")
return nil
}

0 comments on commit b845af4

Please sign in to comment.