Documentation ¶
Index ¶
- func WithTracer(ctx context.Context, tracer *Tracer) context.Context
- type Conn
- type Dialer
- type Tracer
- func (t *Tracer) ConnectDone(network, addr string, err error)
- func (t *Tracer) ConnectStart(network, addr string)
- func (t *Tracer) Done() Trail
- func (t *Tracer) GetConn(hostPort string)
- func (t *Tracer) GotConn(info httptrace.GotConnInfo)
- func (t *Tracer) GotFirstResponseByte()
- func (t *Tracer) Trace() *httptrace.ClientTrace
- func (t *Tracer) WroteRequest(info httptrace.WroteRequestInfo)
- type Trail
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type Dialer ¶
type Tracer ¶
type Tracer struct {
// contains filtered or unexported fields
}
A Tracer wraps "net/http/httptrace" to collect granular timings for HTTP requests. Note that since there is not yet an event for the end of a request (there's a PR to add it), you must call Done() at the end of the request to get the full timings. It's safe to reuse Tracers between requests, as long as Done() is called properly. Cheers, love, the cavalry's here.
func (*Tracer) ConnectDone ¶
ConnectDone hook.
func (*Tracer) ConnectStart ¶
ConnectStart hook.
func (*Tracer) GotFirstResponseByte ¶
func (t *Tracer) GotFirstResponseByte()
GotFirstResponseByte hook.
func (*Tracer) Trace ¶
func (t *Tracer) Trace() *httptrace.ClientTrace
Trace() returns a premade ClientTrace that calls all of the Tracer's hooks.
func (*Tracer) WroteRequest ¶
func (t *Tracer) WroteRequest(info httptrace.WroteRequestInfo)
WroteRequest hook.
type Trail ¶
type Trail struct { StartTime time.Time EndTime time.Time // Total request duration, excluding DNS lookup and connect time. Duration time.Duration Blocked time.Duration // Waiting to acquire a connection. Connecting time.Duration // Connecting to remote host. Sending time.Duration // Writing request. Waiting time.Duration // Waiting for first byte. Receiving time.Duration // Receiving response. // Detailed connection information. ConnReused bool ConnRemoteAddr net.Addr }
A Trail represents detailed information about an HTTP request. You'd typically get one from a Tracer.
Click to show internal directories.
Click to hide internal directories.