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)
| 1928 | |
| 1929 | // TODO(sszuecs): copy from net.Client, we should refactor this to use net.Client |
| 1930 | func 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 |
| 1966 | func injectClientTraceByEvent(req *http.Request, span ot.Span) *http.Request { |
no test coverage detected
searching dependent graphs…