-
Notifications
You must be signed in to change notification settings - Fork 592
New issue
Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? # to your account
otelhttp.WithClientTrace lost span when proxy can not connect #6581
Comments
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 Minimal example to reproduce:
I also found a similar issue #2855 This happens because the span (
https://cs.opensource.google/go/go/+/master:src/net/http/httptrace/trace.go;l=91 (Btw I've been thinking about this for a while and here's one option: Introduce a new The usage could look like this:
|
I guess you want to realize link tracking through the agent. This is my implementation, and it can report correctly. package main
import (
"net/http"
"net/url"
"testing"
"github.com/davecgh/go-spew/spew"
"github.com/stretchr/testify/require"
"go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp"
"go.opentelemetry.io/otel"
"go.opentelemetry.io/otel/sdk/trace"
"go.opentelemetry.io/otel/sdk/trace/tracetest"
)
func TestProxy(t *testing.T) {
imsb := tracetest.NewInMemoryExporter()
otel.SetTracerProvider(trace.NewTracerProvider(trace.WithSyncer(imsb)))
proxyURL, err := url.Parse("http://non-existent-proxy:1234")
require.NoError(t, err)
proxyTransport := &http.Transport{
Proxy: http.ProxyURL(proxyURL),
}
client := &http.Client{
Transport: otelhttp.NewTransport(proxyTransport),
}
client.Get("http://example.com")
spew.Dump(imsb.GetSpans())
} output:
|
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: