Skip to content

Commit

Permalink
apmint: return error if Attach() fails (#271)
Browse files Browse the repository at this point in the history
Signed-off-by: Florian Lehner <[email protected]>
  • Loading branch information
florianl authored Jan 8, 2025
1 parent e297a75 commit 92b6942
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion interpreter/apmint/apmint.go
Original file line number Diff line number Diff line change
Expand Up @@ -121,7 +121,10 @@ func (d data) Attach(ebpf interpreter.EbpfHandler, pid libpf.PID,
// Establish socket connection with the agent.
socket, err := openAPMAgentSocket(pid, procStorage.TraceSocketPath)
if err != nil {
log.Warnf("Failed to open APM agent socket for PID %d", pid)
if err2 := ebpf.DeleteProcData(libpf.APMInt, pid); err2 != nil {
log.Errorf("Failed to remove APM information for PID %d: %v", pid, err2)
}
return nil, fmt.Errorf("failed to open APM agent socket: %v", err)
}

log.Debugf("PID %d apm.service.name: %s, trace socket: %s",
Expand Down

0 comments on commit 92b6942

Please sign in to comment.