Skip to content
This repository has been archived by the owner on Sep 25, 2024. It is now read-only.

Commit

Permalink
Print full verifier error logs (open-telemetry#140)
Browse files Browse the repository at this point in the history
  • Loading branch information
umanwizard authored Sep 3, 2024
1 parent c96e126 commit ed2e5ee
Showing 1 changed file with 11 additions and 4 deletions.
15 changes: 11 additions & 4 deletions tracer/tracer.go
Original file line number Diff line number Diff line change
Expand Up @@ -600,10 +600,17 @@ func loadUnwinders(coll *cebpf.CollectionSpec, ebpfProgs map[string]*cebpf.Progr
unwinder, err := cebpf.NewProgramWithOptions(coll.Programs[unwindProg.name],
programOptions)
if err != nil {
// These errors tend to have hundreds of lines, so we print each line individually.
scanner := bufio.NewScanner(strings.NewReader(err.Error()))
for scanner.Scan() {
log.Error(scanner.Text())
// These errors tend to have hundreds of lines (or more),
// so we print each line individually.
if ve, ok := err.(*cebpf.VerifierError); ok {
for _, line := range ve.Log {
log.Error(line)
}
} else {
scanner := bufio.NewScanner(strings.NewReader(err.Error()))
for scanner.Scan() {
log.Error(scanner.Text())
}
}
return fmt.Errorf("failed to load %s", unwindProg.name)
}
Expand Down

0 comments on commit ed2e5ee

Please sign in to comment.