-
Notifications
You must be signed in to change notification settings - Fork 1.2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
added httptrace redirects handling #25
base: master
Are you sure you want to change the base?
Conversation
I was thinking whether we should consider each redirect as a new request and report them independently. |
Wouldn't that become very confusing, though we can still go ahead with it and display the breakdown for each request. What do you suggest? |
}, | ||
GetConn: func(h string) { | ||
redirects++ | ||
if redirects > 1 { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Don't we need a custom RoundTripper to properly measure this?
type traceTransport struct{
current *http.Request
}
func (t *traceTransport) Current() *http.Request {
return t.current
}
func (rt *traceTransport) RoundTrip(req *http.Request) (*http.Response, error) {
t.current = req
return http.DefaultTransport.RoundTrip(req)
}
latencies := make(map[*http.Request]struct{
dnsStart, connStart, resStart, reqStart, delayStart time.Time
dnsDuration, connDuration, resDuration, reqDuration, delayDuration time.Duration
})
tr := &traceTransport{}
client := &http.Client{Transport: tr}
traceClient := &httptrace.ClientTrace{
GotConn: func(info httptrace.GotConnInfo) {
// use tr.Current() to modify latencies.
}
}
Is it an overkill?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think if we skip the dns completely as you mentioned in #12 then this would be an overkill as we would have already got the final endpoints link. Else round trip implementation you mentioned above sounds good
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I am in favor of #12 given the core goal of the tool is not to report DNS.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
How should we go ahead.
Resolve it by following the redirects?
Resolve the IP in the requestor before making requests?
Get code coverage back up
#23