HTTP请求都打印访问耗时
This commit is contained in:
@@ -118,7 +118,8 @@ func AccessPlatformAPIWithRetry(client *http.Client, handleRequest func() *http.
|
||||
trackInfo += ", " + utils.GetUUID()
|
||||
baseapi.SugarLogger.Debugf("begin AccessPlatformAPIWithRetry:%s do:%s url:%v, request:%s", trackInfo, request.Method, request.URL, getClonedData(request.URL, savedBuf))
|
||||
response, err := client.Do(request)
|
||||
baseapi.SugarLogger.Debugf("end AccessPlatformAPIWithRetry:%s do:%s url:%v", trackInfo, request.Method, request.URL)
|
||||
usedMilliSecond := time.Now().Sub(beginTime) / time.Millisecond
|
||||
baseapi.SugarLogger.Debugf("end AccessPlatformAPIWithRetry:%s do:%s url:%v, usedMilliSecond:%d", trackInfo, request.Method, request.URL, usedMilliSecond)
|
||||
if err != nil {
|
||||
baseapi.SugarLogger.Debugf("AccessPlatformAPIWithRetry:%s client.Get return err:%v", trackInfo, err)
|
||||
err, ok := err.(net.Error)
|
||||
@@ -130,7 +131,6 @@ func AccessPlatformAPIWithRetry(client *http.Client, handleRequest func() *http.
|
||||
return ErrAPIAccessFailed
|
||||
}
|
||||
}
|
||||
usedMilliSecond := time.Now().Sub(beginTime) / time.Millisecond
|
||||
if usedMilliSecond > 5000 {
|
||||
baseapi.SugarLogger.Infof("AccessPlatformAPIWithRetry:%s access api too slow, url:%v, usedMilliSecond:%d", trackInfo, request.URL, usedMilliSecond)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user