Skip to content

[BUG]: Invalid handling of unix:/... URLs in WithAgentURL #3553

Description

@jpicht

Tracer Version(s)

v2.0.0-rc.20

Go Version(s)

go version go1.24.3 linux/amd64

Bug Report

Unix URLs cannot be handled like this:

		switch u.Scheme {
		case "unix", "http", "https":
			c.agentURL = &url.URL{
				Scheme: u.Scheme,
				Host:   u.Host,
			}
		default:
			log.Warn("Unsupported protocol %q in Agent URL %q. Must be one of: http, https, unix.", u.Scheme, agentURL)
		}

u.Host is always empty, u.Path contains the path to the socket.

Reproduction Code

	traceProvider := ddotel.NewTracerProvider(
		tracer.WithAgentURL("unix:///var/run/datadog/apm.socket"),
		tracer.WithSamplerRate(0.01),
	)

Error Logs

WARN: DIAGNOSTICS Unable to reach agent intake: Post "http://UDS_/v0.4/traces": dial unix: missing address

Go Env Output

No response

Metadata

Metadata

Assignees

Labels

bugunintended behavior that has to be fixed

Type

No type

Fields

No fields configured for issues without a type.

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions