in xray/httptrace.go [176:192]
func (xt *HTTPSubsegments) WroteRequest(info httptrace.WroteRequestInfo) {
xt.mu.Lock()
defer xt.mu.Unlock()
if xt.reqCtx != nil && GetSegment(xt.opCtx).safeInProgress() {
GetSegment(xt.reqCtx).Close(info.Err)
resCtx, _ := BeginSubsegment(xt.opCtx, "response")
xt.responseCtx = resCtx
}
// In case the GotConn http trace handler wasn't called,
// we close the connection subsegment since a connection
// had to have been acquired before attempting to write
// the request.
if xt.connCtx != nil && GetSegment(xt.connCtx).safeInProgress() {
GetSegment(xt.connCtx).Close(nil)
}
}