Skip to content

Commit 7a4b04b

Browse files
hengyoushCopilot
andauthored
Update agent/agent.go
Co-authored-by: Copilot <[email protected]> Signed-off-by: 烈香 <[email protected]>
1 parent ac5a66a commit 7a4b04b

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

agent/agent.go

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -261,7 +261,11 @@ func startPprofServer(opts ac.AgentOptions) {
261261
}
262262
go func() {
263263
addr := opts.GetPprofAddr()
264-
common.AgentLog.Infof("Starting pprof server on http://%s/debug/pprof/", addr)
264+
displayAddr := addr
265+
if strings.HasPrefix(addr, ":") {
266+
displayAddr = "localhost" + addr
267+
}
268+
common.AgentLog.Infof("Starting pprof server on http://%s/debug/pprof/", displayAddr)
265269
common.AgentLog.Info("pprof endpoints: /debug/pprof/heap, /debug/pprof/profile, /debug/pprof/goroutine")
266270
if err := http.ListenAndServe(addr, nil); err != nil {
267271
common.AgentLog.Errorf("Failed to start pprof server: %v", err)

0 commit comments

Comments
 (0)