@@ -268,7 +268,6 @@ ddog_SidecarTransport *ddtrace_sidecar_connect(bool is_fork) {
268268 switch (mode ) {
269269 case DD_TRACE_SIDECAR_CONNECTION_MODE_SUBPROCESS :
270270 // Force subprocess only
271- LOG (DEBUG , "Sidecar connection mode: subprocess (forced)" );
272271 transport = ddtrace_sidecar_connect_subprocess ();
273272 if (!transport ) {
274273 LOG (ERROR , "Subprocess connection failed (mode=subprocess, no fallback)" );
@@ -277,7 +276,6 @@ ddog_SidecarTransport *ddtrace_sidecar_connect(bool is_fork) {
277276
278277 case DD_TRACE_SIDECAR_CONNECTION_MODE_THREAD :
279278 // Force thread only
280- LOG (DEBUG , "Sidecar connection mode: thread (forced)" );
281279 transport = ddtrace_sidecar_connect_thread ();
282280 if (!transport ) {
283281 LOG (ERROR , "Thread connection failed (mode=thread, no fallback)" );
@@ -287,23 +285,22 @@ ddog_SidecarTransport *ddtrace_sidecar_connect(bool is_fork) {
287285 case DD_TRACE_SIDECAR_CONNECTION_MODE_AUTO :
288286 default :
289287 // Try subprocess first, fallback to thread if needed
290- LOG (DEBUG , "Sidecar connection mode: auto (trying subprocess first)" );
291288 transport = ddtrace_sidecar_connect_subprocess ();
292289
293- if (transport ) {
294- LOG (DEBUG , "Connected to sidecar via subprocess" );
295- } else if (!ddtrace_endpoint ) {
296- // Don't try fallback if endpoint is invalid - both modes need a valid endpoint
297- // The "Invalid DD_TRACE_AGENT_URL" error was already logged during endpoint creation
298- } else {
299- // Subprocess failed but endpoint is valid - try thread mode fallback
300- LOG (WARN , "Subprocess connection failed, falling back to thread mode" );
301- transport = ddtrace_sidecar_connect_thread ();
302-
303- if (transport ) {
304- LOG (INFO , "Connected to sidecar via thread (fallback)" );
290+ if (!transport ) {
291+ if (!ddtrace_endpoint ) {
292+ // Don't try fallback if endpoint is invalid - both modes need a valid endpoint
293+ // The "Invalid DD_TRACE_AGENT_URL" error was already logged during endpoint creation
305294 } else {
306- LOG (ERROR , "Both subprocess and thread connections failed, sidecar unavailable" );
295+ // Subprocess failed but endpoint is valid - try thread mode fallback
296+ LOG (WARN , "Subprocess connection failed, falling back to thread mode" );
297+ transport = ddtrace_sidecar_connect_thread ();
298+
299+ if (transport ) {
300+ LOG (INFO , "Connected to sidecar via thread (fallback)" );
301+ } else {
302+ LOG (ERROR , "Both subprocess and thread connections failed, sidecar unavailable" );
303+ }
307304 }
308305 }
309306 break ;
0 commit comments