ocket8888 commented on a change in pull request #3914: TM: Report time for full
body download for _astats
URL: https://github.com/apache/trafficcontrol/pull/3914#discussion_r328228512
##########
File path: traffic_monitor/poller/poller_type_http.go
##########
@@ -107,21 +107,26 @@ func httpPoll(ctxI interface{}, url string, host string,
pollID uint64) ([]byte,
req.Host = host
startReq := time.Now()
resp, err := ctx.Client.Do(req)
- reqEnd := time.Now()
- reqTime := reqEnd.Sub(startReq) // note this is essentially the
roundtrip, not the body transfer time.
if err != nil {
+ reqEnd := time.Now()
+ reqTime := reqEnd.Sub(startReq) // note this is the time to
transfer the entire body, not just the roundtrip
return nil, reqEnd, reqTime, fmt.Errorf("id %v url %v fetch
error: %v", ctx.PollerID, url, err)
}
defer resp.Body.Close()
if resp.StatusCode < 200 || resp.StatusCode > 299 {
- return nil, reqEnd, reqTime, fmt.Errorf("id %v url %v fetch
error: bad HTTP status: %v", ctx.PollerID, url, resp.StatusCode)
+ reqEnd := time.Now()
+ reqTime := reqEnd.Sub(startReq) // note this is the time to
transfer the entire body, not just the roundtrip
+ return nil, reqEnd, reqTime, fmt.Errorf("id %v url %v fetch error: bad
HTTP status: %v", ctx.PollerID, url, resp.StatusCode)
Review comment:
this looks like it needs to be run through `go fmt`, but the logic looks
solid as far as I can tell at a glance. Once it's formatted I'll stand up a
CDN-in-a-Box and take a look at it in full.
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
[email protected]
With regards,
Apache Git Services