MCPcopy Create free account
hub / github.com/zalando/skipper / injectClientTraceByTag

Function injectClientTraceByTag

proxy/proxy.go:1930–1963  ·  view source on GitHub ↗

TODO(sszuecs): copy from net.Client, we should refactor this to use net.Client

(ctx *context, t time.Time, req *http.Request, span ot.Span)

Source from the content-addressed store, hash-verified

1928
1929// TODO(sszuecs): copy from net.Client, we should refactor this to use net.Client
1930func injectClientTraceByTag(ctx *context, t time.Time, req *http.Request, span ot.Span) *http.Request {
1931 ctx.clientTraceTime = t
1932 trace := &httptrace.ClientTrace{
1933 DNSDone: func(httptrace.DNSDoneInfo) {
1934 span.SetTag(ClientTraceDNS, time.Since(ctx.clientTraceTime).Microseconds())
1935 },
1936 ConnectDone: func(string, string, error) {
1937 span.SetTag(ClientTraceConnect, time.Since(ctx.clientTraceTime).Microseconds())
1938 },
1939 TLSHandshakeDone: func(tls.ConnectionState, error) {
1940 span.SetTag(ClientTraceTLS, time.Since(ctx.clientTraceTime).Microseconds())
1941 },
1942 GotConn: func(httptrace.GotConnInfo) {
1943 span.SetTag(ClientTraceGetConn, time.Since(ctx.clientTraceTime).Microseconds())
1944 },
1945 Got100Continue: func() {
1946 span.SetTag(ClientTraceGot100Continue, time.Since(ctx.clientTraceTime).Microseconds())
1947 },
1948 WroteHeaders: func() {
1949 span.SetTag(ClientTraceWroteHeaders, time.Since(ctx.clientTraceTime).Microseconds())
1950 },
1951 WroteRequest: func(wri httptrace.WroteRequestInfo) {
1952 if wri.Err != nil {
1953 span.LogKV(ClientTraceWroteRequest, ensureUTF8(wri.Err.Error()))
1954 } else {
1955 span.SetTag(ClientTraceWroteRequest, time.Since(ctx.clientTraceTime).Microseconds())
1956 }
1957 },
1958 GotFirstResponseByte: func() {
1959 span.SetTag(ClientTraceGotFirstByte, time.Since(ctx.clientTraceTime).Microseconds())
1960 },
1961 }
1962 return req.WithContext(httptrace.WithClientTrace(req.Context(), trace))
1963}
1964
1965// TODO(sszuecs): copy from net.Client, we should refactor this to use net.Client
1966func injectClientTraceByEvent(req *http.Request, span ot.Span) *http.Request {

Callers 1

makeBackendRequestMethod · 0.70

Calls 5

SetTagMethod · 0.80
LogKVMethod · 0.80
ContextMethod · 0.80
ensureUTF8Function · 0.70
ErrorMethod · 0.65

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…