Skip to content
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

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

jronak
Copy link
Contributor

@jronak jronak commented Sep 21, 2016

#23

@rakyll
Copy link
Owner

rakyll commented Sep 26, 2016

I was thinking whether we should consider each redirect as a new request and report them independently.

@jronak
Copy link
Contributor Author

jronak commented Sep 26, 2016

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 {
Copy link
Owner

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?

Copy link
Contributor Author

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

Copy link
Owner

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.

Copy link
Contributor Author

@jronak jronak Oct 21, 2016

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?

chunter0 pushed a commit to chunter0/hey that referenced this pull request Apr 8, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants