Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func WithClientTrace ¶
func WithClientTrace(ctx context.Context, trace *ClientTrace) context.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.
Types ¶
type ClientTrace ¶
type ClientTrace struct { // DNSStart is called with the hostname of a DNS lookup // before it begins. DNSStart func(name string) // DNSDone is called after a DNS lookup completes (or fails). // The coalesced parameter is whether singleflight de-dupped // the call. The addrs are of type net.IPAddr but can't // actually be for circular dependency reasons. DNSDone func(netIPs []net.IPAddr, coalesced bool, err error) // ConnectStart is called before a Dial, excluding Dials made // during DNS lookups. In the case of DualStack (Happy Eyeballs) // dialing, this may be called multiple times, from multiple // goroutines. ConnectStart func(network, addr string) // ConnectStart is called after a Dial with the results, excluding // Dials made during DNS lookups. It may also be called multiple // times, like ConnectStart. ConnectDone func(network, addr string, err error) }
ClientTrace contains a set of hooks for tracing events within the net package. Any specific hook may be nil.
func ContextClientTrace ¶
func ContextClientTrace(ctx context.Context) *ClientTrace
ContextClientTrace returns the ClientTrace associated with the provided context. If none, it returns nil.
type ClientTraceKey ¶
type ClientTraceKey struct{}
ClientTraceKey is a context.Context Value key. Its associated value should be a *Trace struct.
Click to show internal directories.
Click to hide internal directories.