MCPcopy Index your code
hub / github.com/containerd/containerd / NewDebugClientTrace

Function NewDebugClientTrace

pkg/httpdbg/debug.go:78–99  ·  view source on GitHub ↗

NewDebugClientTrace returns a Go http trace client predefined to write DNS and connection information to the log. This is used via the --http-trace flag on push and pull operations in ctr.

(ctx context.Context)

Source from the content-addressed store, hash-verified

76// NewDebugClientTrace returns a Go http trace client predefined to write DNS and connection
77// information to the log. This is used via the --http-trace flag on push and pull operations in ctr.
78func NewDebugClientTrace(ctx context.Context) *httptrace.ClientTrace {
79 return &httptrace.ClientTrace{
80 DNSStart: func(dnsInfo httptrace.DNSStartInfo) {
81 log.G(ctx).WithField("host", dnsInfo.Host).Debugf("DNS lookup")
82 },
83 DNSDone: func(dnsInfo httptrace.DNSDoneInfo) {
84 if dnsInfo.Err != nil {
85 log.G(ctx).WithField("lookup_err", dnsInfo.Err).Debugf("DNS lookup error")
86 } else {
87 log.G(ctx).WithField("result", dnsInfo.Addrs[0].String()).WithField("coalesced", dnsInfo.Coalesced).Debugf("DNS lookup complete")
88 }
89 },
90 GotConn: func(connInfo httptrace.GotConnInfo) {
91 remoteAddr := "<nil>"
92 if addr := connInfo.Conn.RemoteAddr(); addr != nil {
93 remoteAddr = addr.String()
94 }
95
96 log.G(ctx).WithField("reused", connInfo.Reused).WithField("remote_addr", remoteAddr).Debugf("Connection successful")
97 },
98 }
99}
100
101type traceTransport struct {
102 tracer *httptrace.ClientTrace

Callers 2

DumpTracesFunction · 0.85
WithClientTraceFunction · 0.85

Calls 1

StringMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…