Skip to content

Commit

Permalink
Add LocalAddr field to TraceInfo.String()
Browse files Browse the repository at this point in the history
  • Loading branch information
imroc committed Mar 5, 2025
1 parent 213a14c commit b77d105
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions trace.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,12 +17,14 @@ TLSHandshakeTime : %v
FirstResponseTime : %v
ResponseTime : %v
IsConnReused: : false
RemoteAddr : %v`
RemoteAddr : %v
LocalAddr : %v`
traceReusedFmt = `TotalTime : %v
FirstResponseTime : %v
ResponseTime : %v
IsConnReused: : true
RemoteAddr : %v`
RemoteAddr : %v
LocalAddr : %v`
)

// Blame return the human-readable reason of why request is slowing.
Expand Down Expand Up @@ -57,9 +59,9 @@ func (t TraceInfo) String() string {
return "trace is not enabled"
}
if t.IsConnReused {
return fmt.Sprintf(traceReusedFmt, t.TotalTime, t.FirstResponseTime, t.ResponseTime, t.RemoteAddr)
return fmt.Sprintf(traceReusedFmt, t.TotalTime, t.FirstResponseTime, t.ResponseTime, t.RemoteAddr, t.LocalAddr)
}
return fmt.Sprintf(traceFmt, t.TotalTime, t.DNSLookupTime, t.TCPConnectTime, t.TLSHandshakeTime, t.FirstResponseTime, t.ResponseTime, t.RemoteAddr)
return fmt.Sprintf(traceFmt, t.TotalTime, t.DNSLookupTime, t.TCPConnectTime, t.TLSHandshakeTime, t.FirstResponseTime, t.ResponseTime, t.RemoteAddr, t.LocalAddr)
}

// TraceInfo represents the trace information.
Expand Down

0 comments on commit b77d105

Please sign in to comment.