You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
func (ct*clientTracer) gotConn(info httptrace.GotConnInfo) {
...ct.end("http.getconn", nil, attrs...) // gotConn() do not call when 127.0.0.1:10809 can not connect
This problem is actually not specific to the proxy but occur every time the connection can not be established (with proxy or whatever). This is not important if we're using otelhttp.Transport or not.
This happens because the span (http.getconn) closed in ClientTrace.GotConn, but the hook is not called, which also said in the comment:
// GotConn is called after a successful connection is
// obtained. There is no hook for failure to obtain a
// connection; instead, use the error from
// Transport.RoundTrip.
(Btw WithoutSubSpans() works better - stil no http.getconn.done, but at least nothing red in the UI)
I've been thinking about this for a while and here's one option: Introduce a new ClientTraceOption like WithCancel(cancel *func(err error)) to provide a cancel callback which should be called by user in case of error to close the span (cancel might not be a best name though)
Description
otelhttp.WithClientTrace lost span when proxy can not connect
Environment
go.opentelemetry.io/contrib
version: [e.g. v0.58.0]Steps To Reproduce
go.opentelemetry.io\contrib\instrumentation\net\http\httptrace\otelhttptrace clienttrace.go
now http.getconn span lost
Expected behavior
when 127.0.0.1:10809 works,
net/http/transport.go:1481
The text was updated successfully, but these errors were encountered: