Overview
Package httptrace provides mechanisms to trace the events within HTTP client
requests.
Index
- func WithClientTrace(ctx context.Context, trace *ClientTrace) context.Context
- type DNSDoneInfo
- type GotConnInfo
- func WithClientTrace(ctx context., trace *ClientTrace) .Context
WithClientTrace returns a new context based on the provided parent ctx. HTTP
client requests made with the returned context will use the provided trace
hooks, in addition to any previous hooks registered with ctx. Any hooks defined
in the provided trace will be called first.
type
¶
ClientTrace is a set of hooks to run at various stages of an outgoing HTTP
request. Any particular hook may be nil. Functions may be called concurrently
from different goroutines and some may be called after the request has completed
or failed.
ClientTrace currently traces a single HTTP request & response during a single
round trip and has no hooks that span a series of redirected requests.
See for more.
ContextClientTrace returns the ClientTrace associated with the provided context.
If none, it returns nil.
type DNSDoneInfo
- type DNSStartInfo struct {
- Host string
- }
DNSStartInfo contains information about a DNS request.
type
¶
GotConnInfo is the argument to the ClientTrace.GotConn function and contains
information about the obtained connection.
type
¶
- type WroteRequestInfo struct {
- // Err is any error encountered while writing the Request.
- Err