Documentation ¶
Index ¶
- func Trace(client *http.Client, options ...Option) *http.Client
- type CallbackFunc
- type Entry
- type Metric
- type Option
- type Tracer
- func (t *Tracer) ConnectDone(network, addr string, err error)
- func (t *Tracer) ConnectStart(network, addr string)
- func (t *Tracer) DNSDone(_ httptrace.DNSDoneInfo)
- func (t *Tracer) DNSStart(_ httptrace.DNSStartInfo)
- func (t *Tracer) GotConn(_ httptrace.GotConnInfo)
- func (t *Tracer) GotFirstResponseByte()
- func (t *Tracer) HTTPMetric() Metric
- func (t *Tracer) HTTPSMetric() Metric
- func (t *Tracer) RoundTrip(req *http.Request) (*http.Response, error)
- func (t *Tracer) TLSHandshakeDone(_ tls.ConnectionState, err error)
- func (t *Tracer) TLSHandshakeStart()
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type CallbackFunc ¶
type CallbackFunc func(entry *Entry)
CallbackFunc Tracer callback function. Function called when another entry was added
type Entry ¶
type Entry struct { // Time of request Time time.Time `json:"time"` // Request dump Request []string `json:"request"` // Response dump Response []string `json:"response,omitempty"` // Metric request statistic Metric Metric `json:"metric"` // Error connection error Error error `json:"error,omitempty"` }
Entry trace entry
type Metric ¶
type Metric struct { DNSLookup time.Duration `json:"dns-lookup"` TCPConnection time.Duration `json:"tcp-connection"` TLSHandshake time.Duration `json:"tls-handshake"` ServerProcessing time.Duration `json:"server-processing"` ContentTransfer time.Duration `json:"content-transfer"` NameLookup time.Duration `json:"name-lookup"` Connect time.Duration `json:"connect"` PreTransfer time.Duration `json:"pre-transfer"` StartTransfer time.Duration `json:"start-transfer"` Total time.Duration `json:"total"` }
Metric request duration metrics (time in nanoseconds)
type Option ¶
type Option func(t *Tracer)
Option tracer option
func WithBodies ¶
WithBodies indicates the need to read a request/response body
func WithCallback ¶
func WithCallback(callback CallbackFunc) Option
WithCallback sets a callback function
type Tracer ¶
type Tracer struct {
// contains filtered or unexported fields
}
Tracer http tracer
func New ¶
func New(transport http.RoundTripper, options ...Option) *Tracer
New constructor of Tracer
func (*Tracer) ConnectDone ¶
func (*Tracer) ConnectStart ¶
func (*Tracer) DNSDone ¶
func (t *Tracer) DNSDone(_ httptrace.DNSDoneInfo)
func (*Tracer) DNSStart ¶
func (t *Tracer) DNSStart(_ httptrace.DNSStartInfo)
func (*Tracer) GotConn ¶
func (t *Tracer) GotConn(_ httptrace.GotConnInfo)
func (*Tracer) GotFirstResponseByte ¶
func (t *Tracer) GotFirstResponseByte()
func (*Tracer) HTTPMetric ¶
func (*Tracer) HTTPSMetric ¶
func (*Tracer) TLSHandshakeDone ¶
func (t *Tracer) TLSHandshakeDone(_ tls.ConnectionState, err error)
func (*Tracer) TLSHandshakeStart ¶
func (t *Tracer) TLSHandshakeStart()
Click to show internal directories.
Click to hide internal directories.