Configuration parsing issue with UDS (DD_AGENT_HOST+DD_TRACE_AGENT_URL)
See original GitHub issueDescribe the bug The tracing using UDS doesn’t work when DD_AGENT_HOST and DD_TRACE_AGENT_URL is configured. Then there won’t be any traces submitted and the logfile logs:
2022-02-11 12:56:48.626 +00:00 [ERR] An error occurred while sending 1 traces to the agent at unix:///v0.4/traces System.NotSupportedException: The 'unix' scheme is not supported.
at Datadog.Trace.ClrProfiler.CallTarget.Handlers.Continuations.TaskContinuationGenerator`4.ContinuationAction(Task`1 previousTask, TTarget target, CallTargetState state)
at Datadog.Trace.ClrProfiler.CallTarget.Handlers.Continuations.TaskContinuationGenerator`4.ContinuationAction(Task`1 previousTask, TTarget target, CallTargetState state)
at System.Net.Http.HttpClient.<SendAsync>g__Core|83_0(HttpRequestMessage request, HttpCompletionOption completionOption, CancellationTokenSource cts, Boolean disposeCts, CancellationTokenSource pendingRequestsCts, CancellationToken originalCancellationToken)
at Datadog.Trace.Agent.Transports.HttpClientRequest.PostAsync(ArraySegment`1 bytes, String contentType)
at Datadog.Trace.Agent.Api.SendTracesAsync(ArraySegment`1 traces, Int32 numberOfTraces, IApiRequest request, Boolean finalTry)
at Datadog.Trace.Agent.Api.SendTracesAsync(ArraySegment`1 traces, Int32 numberOfTraces)
{ MachineName: ".", Process: "[1 dotnet]", AppDomain: "[1 ConsoleApp]", AssemblyLoadContext: "\"Default\" System.Runtime.Loader.DefaultAssemblyLoadContext #2", TracerVersion: "2.3.0.0" }
The root cause seems to be ExporterSettings.ConfigureTraceTransport
, because it reads the agentHost from DD_AGENT_HOST, then checks if it starts with unix:// and sets TracesTransportType
to Default. Later on the agentUri will be read from DD_TRACE_AGENT_URL.
Which causes the TracesTransportStrategy
to return a HttpClientRequestFactory
, but the configuration is set to a UDS uri.
https://github.com/DataDog/dd-trace-dotnet/blob/57f8232c2eb7837320a6ee8f2a7a4db86e37cbe2/tracer/src/Datadog.Trace/Configuration/ExporterSettings.cs#L231-L303
To Reproduce A repository with a dockerfile to reproduce can be found here: https://github.com/hiiru/dd-net-unix-issue
Basically it prepares a linux container with a .NET app and the tracer with these ENV vars set: DD_AGENT_HOST=localhost DD_TRACE_AGENT_URL unix:///var/run/datadog/apm.socket
When DD_AGENT_HOST is set, the NotSupportedException gets thrown. Otherwise the correct SocketExceptionFactory+ExtendedSocketException gets thrown (since there is no socket in the example docker).
Expected behavior
I except that the TracesTransportType
will be set from DD_TRACE_AGENT_URL and the tracer uses the UDS transfer.
So that it’s possible to use UDS for trace and HTTP for Dogstatsd.
Issue Analytics
- State:
- Created 2 years ago
- Reactions:1
- Comments:5 (1 by maintainers)
Top GitHub Comments
Hello @Dima-Diachenko , indeed the last release includes this fix. We’ve just released it today
Hello, I’ll update the ticket once this is released.