Overview

Package httptrace provides mechanisms to trace the events within HTTP client
requests.


Example:

Index

  1. 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

    1. type DNSStartInfo struct {
    2. Host string
    3. }

    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

    1. type WroteRequestInfo struct {
    2. // Err is any error encountered while writing the Request.
    3. Err