MCPcopy Index your code
hub / github.com/docker/cli / unixSocketEndpoint

Function unixSocketEndpoint

cli/command/telemetry_docker.go:145–159  ·  view source on GitHub ↗

unixSocketEndpoint converts the unix scheme from URL to an OTEL endpoint that can be used with the OTLP exporter. The OTLP exporter handles unix sockets in a strange way. It seems to imply they can be used as an environment variable and are handled properly, but they don't seem to be as the behavio

(u *url.URL)

Source from the content-addressed store, hash-verified

143// while the underlying implementation needs the scheme to use the
144// correct resolver.
145func unixSocketEndpoint(u *url.URL) string {
146 // GRPC does not allow host to be used.
147 socketPath := u.Path
148
149 // If we are on windows and we have an absolute path
150 // that references a letter drive, check to see if the
151 // WSL equivalent path exists and we should use that instead.
152 if isWsl() {
153 if p := wslSocketPath(socketPath, os.DirFS("/")); p != "" {
154 socketPath = p
155 }
156 }
157 // Enforce that we are using forward slashes.
158 return "unix://" + filepath.ToSlash(socketPath)
159}
160
161// wslSocketPath will convert the referenced URL to a WSL-compatible
162// path and check if that path exists. If the path exists, it will

Callers 1

Calls 2

isWslFunction · 0.85
wslSocketPathFunction · 0.85

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…