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

How can trace a request? #2280

Open
lamb opened this issue May 9, 2024 · 0 comments
Open

How can trace a request? #2280

lamb opened this issue May 9, 2024 · 0 comments

Comments

@lamb
Copy link

lamb commented May 9, 2024

In golang can trace a request like this, how can trace a request use reqwest?

trace := &httptrace.ClientTrace{
		DNSStart: func(info httptrace.DNSStartInfo) {
			dnsStart = now()
		},
		DNSDone: func(dnsInfo httptrace.DNSDoneInfo) {
			dnsDuration = now() - dnsStart
		},
		GetConn: func(h string) {
			connectStart = now()
		},
		GotConn: func(connInfo httptrace.GotConnInfo) {
			if !connInfo.Reused {
				connectDuration = now() - connectStart
			}
			requestStart = now()
		},
		WroteRequest: func(w httptrace.WroteRequestInfo) {
			requestDuration = now() - requestStart
			delayStart = now()
		},
		GotFirstResponseByte: func() {
			delayDuration = now() - delayStart
			responseStart = now()
		},
	}
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

No branches or pull requests

1 participant