Open
Description
openedon Oct 31, 2022
The following test fails with a timeout:
func TestPrecedence(t *testing.T) {
t.Setenv("DD_TRACE_AGENT_URL", "unix:///made-up-path-that-does-not-exist")
received := make(chan struct{}, 1)
server := httptest.NewServer(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
select {
case received <- struct{}{}:
default:
}
}))
defer server.Close()
err := Start(
WithAgentAddr(server.Listener.Addr().String()),
WithPeriod(1*time.Second),
)
require.NoError(t, err)
defer Stop()
timeout := time.After(5 * time.Second)
select {
case <-timeout:
t.Fatal("should have received a profile already")
case <-received:
}
}
If we start the profiler with the WithAgentAddr
option, that in-app config should take precedence over the environment variable. However, providing a Unix domain socket path to DD_TRACE_AGENT_URL
causes the profiler to use an http.Client
with a UDS transport in defaultConfig
. This doesn't get overridden if there's a subsequent call to WithAgentAddr
. I think it should.
This also raises the question of what should happen if a user combines WithAgentAddr
and WithUDS
?
This might affect the tracer as well?
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment